{"id":419,"date":"2010-02-12T06:50:50","date_gmt":"2010-02-12T14:50:50","guid":{"rendered":"http:\/\/www.visophyte.org\/blog\/?p=419"},"modified":"2010-02-12T06:50:50","modified_gmt":"2010-02-12T14:50:50","slug":"using-systemtap-to-figure-what-your-mozilla-apps-event-loop-is-up-to","status":"publish","type":"post","link":"https:\/\/www.visophyte.org\/blog\/2010\/02\/12\/using-systemtap-to-figure-what-your-mozilla-apps-event-loop-is-up-to\/","title":{"rendered":"Using systemtap to figure what your mozilla app&#8217;s event loop is up to"},"content":{"rendered":"<pre>====================                                             ms    #\r\n----- Event Loop:\r\n  nsTimerEvent                                                 1233   31\r\n  nsProxyObjectCallInfo                                          19   44\r\n  nsStreamCopierOB                                                1   48\r\n  nsStreamCopierIB                                                0   18\r\n  nsProxyCallCompletedEvent                                       0   44\r\n  nsProxyReleaseEvent                                             0   27\r\n  nsTransportStatusEvent                                          0   19\r\n  nsSocketEvent                                                   0   18\r\n  nsHttpConnectionMgr::nsConnEvent                                0    1\r\n----- Timers:\r\n  OnBiffTimer(...)                                             1129    3\r\n  nsGlobalWindow::TimerCallback(...)                             70   10\r\n  nsAutoSyncManager::TimerCallback(...)                          29    6\r\n  nsExpirationTracker::TimerCallback(...)                         1    1\r\n  nsIdleService::IdleTimerCallback(...)                           0    5\r\n  nsExpirationTracker::TimerCallback(...)                         0    1\r\n  nsHttpHandler                                                   0    1\r\n  nsUITimerCallback                                               0    2\r\n  imgContainer::sDiscardTimerCallback(...)                        0    1\r\n  nsExpirationTracker::TimerCallback(...)                         0    1<\/pre>\n<p>That&#8217;s one of the periodic outputs (10 seconds currently) of <a href=\"http:\/\/hg.mozilla.org\/users\/bugmail_asutherland.org\/tb-test-help\/file\/242751f061f8\/systemtap\/moz-event-loop.stp\">this systemtap script<\/a> filtered through <a href=\"http:\/\/hg.mozilla.org\/users\/bugmail_asutherland.org\/tb-test-help\/file\/242751f061f8\/addrsymfilt.py\">this python script<\/a> to translate addresses to useful symbol names in realtime.\u00a0 It&#8217;s like top for mozilla.<\/p>\n<p>Actual invocation looks like so:<br \/>\n<em>sudo stap -v moz-event-loop.stp \/path\/to\/thunderbird\/objdir\/mozilla\/dist\/lib\/libxpcom_core.so | ..\/addrsymfilt.py `pgrep thunderbird-bin`<\/em><\/p>\n<p>The giant caveat (and giant hooray for utrace and Fedora having kernels with the utrace patches built-in) is that the magic in here is done dynamically using utrace source line probes.\u00a0 As such, the probes aren&#8217;t resilient in the face of changes to the underlying source files; the current line numbers are targeted at 1.9.2.\u00a0 There are various in-tree and out-of-tree solutions possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>==================== ms # &#8212;&#8211; Event Loop: nsTimerEvent 1233 31 nsProxyObjectCallInfo 19 44 nsStreamCopierOB 1 48 nsStreamCopierIB 0 18 nsProxyCallCompletedEvent 0 44 nsProxyReleaseEvent 0 27 nsTransportStatusEvent 0 19 nsSocketEvent 0 18 nsHttpConnectionMgr::nsConnEvent 0 1 &#8212;&#8211; Timers: OnBiffTimer(&#8230;) 1129 3 nsGlobalWindow::TimerCallback(&#8230;) 70 &hellip; <a href=\"https:\/\/www.visophyte.org\/blog\/2010\/02\/12\/using-systemtap-to-figure-what-your-mozilla-apps-event-loop-is-up-to\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7,3],"tags":[76,77],"class_list":["post-419","post","type-post","status-publish","format-standard","hentry","category-debugging","category-mozilla","tag-systemtap","tag-utrace"],"_links":{"self":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/comments?post=419"}],"version-history":[{"count":3,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/419\/revisions"}],"predecessor-version":[{"id":422,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/419\/revisions\/422"}],"wp:attachment":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/media?parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/categories?post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/tags?post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}