{"id":344,"date":"2015-08-17T04:27:33","date_gmt":"2015-08-17T04:27:33","guid":{"rendered":"http:\/\/halobates.de\/blog\/?p=344"},"modified":"2015-08-17T04:27:33","modified_gmt":"2015-08-17T04:27:33","slug":"announcing-simple-pt-a-simple-processor-trace-implementation","status":"publish","type":"post","link":"http:\/\/halobates.de\/blog\/p\/344","title":{"rendered":"Announcing simple-pt &#8212; A simple Processor Trace implementation"},"content":{"rendered":"<p>Modern Intel Core CPUs (5th and 6th generation) have a Intel Processor Trace (PT) feature to trace branch execution with low overhead. This is useful for performance analysis and debugging.<\/p>\n<p>simple-pt is a simple standalone driver and decoder tool to implement PT on Linux.<\/p>\n<p>Starting with Linux 4.1 Linux already has a integrated PT implementation in perf (see <a href=\"https:\/\/lwn.net\/Articles\/648154\/\">https:\/\/lwn.net\/Articles\/648154\/<\/a> ). simple-pt is an alternative implementation. It has many disadvantages over the perf PT implementation, such as:<br \/>\n&#8211; needs to run as root<br \/>\n&#8211; no long term tracing or sampling with interrupts<br \/>\n&#8211; no support for interactive debugging (use gdb 7.10 on perf for that)<br \/>\n&#8211; no support for histograms<br \/>\n&#8211; somewhat experimental<br \/>\n&#8211; not as well supported as perf<\/p>\n<p>On the positive side simple-pt is:<br \/>\n&#8211; simple<br \/>\n&#8211; standalone. No kernel changes needed. Could be ported to older kernels or other operating systems<br \/>\n&#8211; easy to modify and experiment with<br \/>\n&#8211; more ftrace like decoding tool<br \/>\n&#8211; support for kprobes based triggers<br \/>\n&#8211; modular &#8220;unix style&#8221; design with simple tools that do only one thing each<br \/>\n&#8211; BSD licensed<\/p>\n<p>Example output:<\/p>\n<pre>\r\n<code>\r\n        % sptcmd  -c tcall taskset -c 0 .\/tcall\r\n        cpu   0 offset 1027688,  1003 KB, writing to ptout.0\r\n        ...\r\n        Wrote sideband to ptout.sideband\r\n        % sptdecode --sideband ptout.sideband --pt ptout.0 | less\r\n        TIME      DELTA  INSNs   OPERATION\r\n        frequency 32\r\n        0        [+0]     [+   1] _dl_aux_init+436\r\n                          [+   6] __libc_start_main+455 -> _dl_discover_osversion\r\n        ...\r\n                          [+  13] __libc_start_main+446 -> main\r\n                          [+   9]     main+22 -> f1\r\n                          [+   4]             f1+9 -> f2\r\n                          [+   2]             f1+19 -> f2\r\n                          [+   5]     main+22 -> f1\r\n                          [+   4]             f1+9 -> f2\r\n                          [+   2]             f1+19 -> f2\r\n                          [+   5]     main+22 -> f1\r\n        ...\r\n<\/code>\r\n<\/pre>\n<p>Available from <a href=\"https:\/\/github.com\/andikleen\/simple-pt\">https:\/\/github.com\/andikleen\/simple-pt<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Modern Intel Core CPUs (5th and 6th generation) have a Intel Processor Trace (PT) feature to trace branch execution with low overhead. This is useful for performance analysis and debugging. simple-pt is a simple standalone driver and decoder tool to implement PT on Linux. Starting with Linux 4.1 Linux already has a integrated PT implementation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,17],"tags":[],"_links":{"self":[{"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/posts\/344"}],"collection":[{"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":10,"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":354,"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/posts\/344\/revisions\/354"}],"wp:attachment":[{"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/categories?post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/halobates.de\/blog\/wp-json\/wp\/v2\/tags?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}