среда, 18 мая 2016 г.

How can I see or clear Nuke memory usage

nuke.clearRAMCache()
nuke.clearDiskCache()

def bytesto(bytes, to, bsize=1024):
    """convert bytes to megabytes, etc.
    sample code:
    print('mb= ' + str(bytesto(314575262000000, 'm')))
    sample output:
    mb= 300002347.946
    """
    a = {'k': 1, 'm': 2, 'g': 3, 't': 4, 'p': 5, 'e': 6}
    r = float(bytes)
    # print 'r {}'.format(r)
    for i in range(a[to]):
        r = r / bsize

    return (r)

print nuke.memory("info")
print nuke.memory("info", 'Read1')

print '{} Mb'.format(bytesto(nuke.memory("free"),'m'))
print '{} Mb'.format(bytesto(nuke.memory("usage"),'m'))
print '{} Mb'.format(bytesto(nuke.memory("total_ram"),'m'))
print '{} Gb'.format(bytesto(nuke.memory("total_vm"),'g'))

read about memory options:
print help(nuke.memory)

Комментариев нет:

Отправить комментарий

Постоянные читатели