Skip to content

Instantly share code, notes, and snippets.

@abidrahmank
Last active December 17, 2015 18:19
Show Gist options
  • Save abidrahmank/5652354 to your computer and use it in GitHub Desktop.
Save abidrahmank/5652354 to your computer and use it in GitHub Desktop.
profile multiprocess code
In [8]: %prun single_process(contours)
6000013 function calls in 39.007 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
3000000 36.424 0.000 36.424 0.000 {cv2.pointPolygonTest}
1 2.056 2.056 39.006 39.006 pointpolygontest.py:18(single_process)
3000000 0.514 0.000 0.514 0.000 {method 'itemset' of 'numpy.ndarray' objects}
4 0.010 0.002 0.010 0.002 {numpy.core.multiarray.zeros}
1 0.003 0.003 0.003 0.003 {cv2.normalize}
1 0.001 0.001 39.007 39.007 <string>:1(<module>)
4 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
=====================================================================================================
# multiprocessing code profile
In [9]: %prun process(contours)
671 function calls in 22.188 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
78 22.163 0.284 22.163 0.284 {method 'acquire' of 'thread.lock' objects}
1 0.011 0.011 22.188 22.188 pointpolygontest.py:39(process)
1 0.004 0.004 0.004 0.004 {numpy.core.multiarray.zeros}
1 0.003 0.003 0.003 0.003 {cv2.normalize}
11 0.001 0.000 0.001 0.000 {thread.start_new_thread}
32 0.001 0.000 0.001 0.000 threading.py:185(__init__)
11 0.000 0.000 0.005 0.000 threading.py:484(start)
11 0.000 0.000 0.002 0.000 threading.py:435(__init__)
15 0.000 0.000 22.164 1.478 threading.py:234(wait)
1 0.000 0.000 0.006 0.006 pool.py:186(_repopulate_pool)
32 0.000 0.000 0.001 0.000 threading.py:180(Condition)
11 0.000 0.000 0.000 0.000 threading.py:410(_newname)
5 0.000 0.000 22.161 4.432 pool.py:605(next)
8 0.000 0.000 0.002 0.000 __init__.py:63(__init__)
11 0.000 0.000 0.003 0.000 threading.py:399(wait)
54 0.000 0.000 0.000 0.000 threading.py:57(__init__)
8 0.000 0.000 0.004 0.001 __init__.py:70(start)
1 0.000 0.000 0.009 0.009 pool.py:113(__init__)
11 0.000 0.000 0.000 0.000 threading.py:467(_set_daemon)
11 0.000 0.000 0.001 0.000 threading.py:370(__init__)
27 0.000 0.000 0.000 0.000 threading.py:825(currentThread)
8 0.000 0.000 0.000 0.000 weakref.py:243(__init__)
16 0.000 0.000 0.000 0.000 threading.py:225(_is_owned)
3 0.000 0.000 0.000 0.000 Queue.py:26(__init__)
11 0.000 0.000 0.001 0.000 threading.py:363(Event)
41 0.000 0.000 0.000 0.000 {thread.allocate_lock}
23 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
11 0.000 0.000 0.000 0.000 threading.py:707(daemon)
15 0.000 0.000 0.000 0.000 threading.py:222(_acquire_restore)
27 0.000 0.000 0.000 0.000 threading.py:62(_note)
8 0.000 0.000 0.000 0.000 weakref.py:261(__setitem__)
8 0.000 0.000 0.000 0.000 {method 'replace' of 'str' objects}
8 0.000 0.000 0.000 0.000 threading.py:686(name)
15 0.000 0.000 0.000 0.000 threading.py:219(_release_save)
33 0.000 0.000 0.000 0.000 {method 'release' of 'thread.lock' objects}
1 0.000 0.000 0.000 0.000 pool.py:247(imap_unordered)
1 0.000 0.000 0.000 0.000 util.py:174(__init__)
27 0.000 0.000 0.000 0.000 {thread.get_ident}
1 0.000 0.000 0.000 0.000 pool.py:592(__init__)
22 0.000 0.000 0.000 0.000 threading.py:379(isSet)
11 0.000 0.000 0.000 0.000 threading.py:702(daemon)
1 0.000 0.000 0.000 0.000 threading.py:276(notify)
1 0.000 0.000 0.000 0.000 pool.py:687(_setup_queues)
9 0.000 0.000 0.000 0.000 {method 'popleft' of 'collections.deque' objects}
1 0.000 0.000 0.000 0.000 Queue.py:107(put)
1 0.000 0.000 0.009 0.009 pool.py:684(__init__)
8 0.000 0.000 0.000 0.000 threading.py:681(name)
1 0.000 0.000 22.188 22.188 <string>:1(<module>)
8 0.000 0.000 0.000 0.000 util.py:70(debug)
3 0.000 0.000 0.000 0.000 Queue.py:197(_init)
1 0.000 0.000 0.000 0.000 Queue.py:204(_put)
1 0.000 0.000 0.000 0.000 {range}
1 0.000 0.000 0.000 0.000 {method 'remove' of 'list' objects}
1 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'append' of 'collections.deque' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
1 0.000 0.000 0.000 0.000 pool.py:602(__iter__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment