Closed ErikBjare closed 8 years ago
I did a long-duration profiling (with very little user activity) which might be useful when optimizing and for comparing with future profilings. Here there was no weird 100% CPU core allocation bug.
20459418 function calls (20482128 primitive calls) in 236.565 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
240902 3.379 0.000 153.168 0.001 /home/erb/Programming/Python/activity-watch/activitywatch/watchers/linux.py:111(X11Watcher.loop)
240903 12.319 0.000 149.789 0.001 /home/erb/Programming/Python/activity-watch/activitywatch/watchers/linux.py:56(X11Watcher.update_active_window)
240924 2.671 0.000 128.337 0.001 /usr/lib/python3.5/site-packages/Xlib/xobject/drawable.py:451(Window.get_full_property)
240925 8.879 0.000 125.247 0.001 /usr/lib/python3.5/site-packages/Xlib/xobject/drawable.py:434(Window.get_property)
240927 6.218 0.000 115.440 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/rq.py:1470(InternAtom.__init__)
240927 5.357 0.000 92.308 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/rq.py:1483(InternAtom.reply)
241534/241686 20.671 0.000 85.821 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/display.py:344(_BaseDisplay.send_and_recv)
49868/49877 43.455 0.001 54.235 0.001 /usr/lib/python3.5/threading.py:851(Thread.run)
241941 8.081 0.000 36.953 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/display.py:621(_BaseDisplay.parse_response)
241735 7.515 0.000 26.641 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/display.py:719(_BaseDisplay.parse_request_response)
124694/124703 2.505 0.000 18.807 0.000 /usr/lib/python3.5/threading.py:531(Event.wait)
482951/482953 17.188 0.000 17.188 0.000 select:0(select)
124554/124563 5.257 0.000 14.614 0.000 /usr/lib/python3.5/threading.py:261(Condition.wait)
241719/241721 12.419 0.000 12.419 0.000 time:0(sleep)
240921 3.431 0.000 12.126 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/rq.py:1503(InternAtom._parse_response)
49867/49874 0.569 0.000 10.648 0.000 /home/erb/Programming/Python/activity-watch/activitywatch/watchers/afk.py:12(_repeat_trigger)
240967 3.687 0.000 9.955 0.000 <string>:1(Struct.to_binary)
49876/49877 0.712 0.000 8.494 0.000 /usr/lib/python3.5/threading.py:826(KeyboardListener.start)
242483 3.436 0.000 8.122 0.000 <string>:1(Struct.parse_binary)
501790/501803 2.819 0.000 7.124 0.000 __builtin__:0(<method 'acquire' of '_thread.lock' objects>)
241004 4.848 0.000 6.540 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/display.py:310(_BaseDisplay.send_request)
4828052 5.794 0.000 5.794 0.000 /usr/lib/python3.5/site-packages/Xlib/support/lock.py:33(_DummyLock.__noop)
241735 4.009 0.000 5.085 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/display.py:838(_BaseDisplay.get_waiting_replyrequest)
242226 4.344 0.000 4.344 0.000 __builtin__:0(<method 'send' of '_socket.socket' objects>)
240903 1.311 0.000 4.303 0.000 /home/erb/Programming/Python/activity-watch/activitywatch/watchers/linux.py:126(X11Watcher.get_window)
240925 3.062 0.000 4.148 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/rq.py:289(Window.check_value)
240919 3.919 0.000 3.919 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/rq.py:629(PropertyData.parse_binary_value)
48671/48672 1.151 0.000 3.872 0.000 /usr/lib/python3.5/selectors.py:356(PollSelector.select)
241941 3.792 0.000 3.800 0.000 __builtin__:0(<method 'recv' of '_socket.socket' objects>)
6138/24938 0.000 0.000 3.723 0.000 /home/erb/Programming/Python/activity-watch/activitywatch/watchers/afk.py:17(_wait_for_either)
240914 1.811 0.000 3.233 0.000 /usr/lib/python3.5/site-packages/Xlib/display.py:444(Display.get_atom)
240903 2.159 0.000 2.992 0.000 /usr/lib/python3.5/site-packages/Xlib/display.py:185(Display.create_resource_object)
49878 0.993 0.000 2.797 0.000 /usr/lib/python3.5/threading.py:755(KeyboardListener.__init__)
1204601 2.765 0.000 2.765 0.000 /usr/lib/python3.5/site-packages/Xlib/protocol/rq.py:1413(InternAtom.__getattr__)
48671/48672 2.498 0.000 2.498 0.000 __builtin__:0(<method 'poll' of 'select.poll' objects>)
There was more but it seemed excessive to include. Future profilings should not include builtins.
Profiling is currently available via the profile.py script.
Closing for now.
Would be nice with a
--profiling
argument that profiled everything in the program (or a specific agent/module).Would help greatly in solving #22 and reducing similar issues in the future.