forked from wo1fsea/PyTexturePacker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_profile.py
38 lines (27 loc) · 976 Bytes
/
main_profile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
Huang Quanyong (wo1fSea)
Date:
2016/11/06
Description:
main_profile.py
----------------------------------------------------------------------------"""
from PyTexturePacker import Packer
def pack_test():
packer = Packer.create(max_width=2048, max_height=2048, bg_color=0xffffff00, trim_mode=1)
packer.pack("test_image/", "test_image%d")
def main():
import cProfile
# cProfile.run("pack_test()")
cProfile.run("pack_test()", "result")
# >python -m cProfile myscript.py -o result
import pstats
p = pstats.Stats("result")
p.strip_dirs().sort_stats(-1).print_stats()
p.strip_dirs().sort_stats("name").print_stats()
p.strip_dirs().sort_stats("cumulative").print_stats(10)
p.sort_stats('tottime', 'cumtime').print_stats(.5, 'pack_test')
if __name__ == '__main__':
main()