cocos统计内存的 py 脚本

前端之家收集整理的这篇文章主要介绍了cocos统计内存的 py 脚本前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
import re,datetime

#...anniudizuoshan/anniudizuoshan.pvr.ccz" rc=15 id=12 116 x 256 @ 32 bpp => 116 KB
def action():
    file_name = '/Users/jiangxf/Desktop/funstone/log2.txt'
    file = open(file_name,'r')

    data = {}

    a = 0
    for (num,line) in enumerate(file):
        m = re.search(r'^.*\/(.*)\..* (.*) KB$',line)
        if m:
            b = m.group(2)

        if b:
            a += int(b)
            # print(num)
            # print(m.group(1))

            data[m.group(1)] = int(b)

    a = a / 1024
    print (a," MB")

    data = sorted(data.items(),key = lambda x: x[1],reverse = True)
    #print (data)
    for k,v in enumerate(data):
        print k,v

    file.close()


if __name__ == '__main__':
    action()
--sharedTextureCache:dumpCachedTextureInfo()
    --cc.TextureCache.dumpCachedTextureInfo()
    local s =cc.Director:getInstance():getTextureCache():getCachedTextureInfo()
    print(s)

    local path_ = CCFileUtils:sharedFileUtils():getWritablePath().."/out.txt"
    print(path_)

    local f = io.open(path_,"w+")
    f:write(s);
    f:close();
原文链接:https://www.f2er.com/cocos2dx/338232.html

猜你在找的Cocos2d-x相关文章