]> pere.pagekite.me Git - homepage.git/blob - blog/data/2016-08-11-coz-profiler.txt
Generated.
[homepage.git] / blog / data / 2016-08-11-coz-profiler.txt
1 Title: Coz can help you find bottlenecks in multi-threaded software - nice free software
2 Tags: english, debian, nice free software
3 Date: 2016-08-11 12:00
4
5 <p>This summer, I read a great article
6 "<a href="https://www.usenix.org/publications/login/summer2016/curtsinger">coz:
7 This Is the Profiler You're Looking For</a>" in USENIX ;login: about
8 how to profile multi-threaded programs. It presented a system for
9 profiling software by running experiences in the running program,
10 testing how run time performance is affected by "speeding up" parts of
11 the code to various degrees compared to a normal run. It does this by
12 slowing down parallel threads while the "faster up" code is running
13 and measure how this affect processing time. The processing time is
14 measured using probes inserted into the code, either using progress
15 counters (COZ_PROGRESS) or as latency meters (COZ_BEGIN/COZ_END). It
16 can also measure unmodified code by measuring complete the program
17 runtime and running the program several times instead.</p>
18
19 <p>The project and presentation was so inspiring that I would like to
20 get the system into Debian. I
21 <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=830708">created
22 a WNPP request for it</a> and contacted upstream to try to make the
23 system ready for Debian by sending patches. The build process need to
24 be changed a bit to avoid running 'git clone' to get dependencies, and
25 to include the JavaScript web page used to visualize the collected
26 profiling information included in the source package.
27 But I expect that should work out fairly soon.</p>
28
29 <p>The way the system work is fairly simple. To run an coz experiment
30 on a binary with debug symbols available, start the program like this:
31
32 <p><blockquote><pre>
33 coz run --- program-to-run
34 </pre></blockquote></p>
35
36 <p>This will create a text file profile.coz with the instrumentation
37 information. To show what part of the code affect the performance
38 most, use a web browser and either point it to
39 <a href="http://plasma-umass.github.io/coz/">http://plasma-umass.github.io/coz/</a>
40 or use the copy from git (in the gh-pages branch). Check out this web
41 site to have a look at several example profiling runs and get an idea what the end result from the profile runs look like. To make the
42 profiling more useful you include &lt;coz.h&gt; and insert the
43 COZ_PROGRESS or COZ_BEGIN and COZ_END at appropriate places in the
44 code, rebuild and run the profiler. This allow coz to do more
45 targeted experiments.</p>
46
47 <p>A video published by ACM
48 <a href="https://www.youtube.com/watch?v=jE0V-p1odPg">presenting the
49 Coz profiler</a> is available from Youtube. There is also a paper
50 from the 25th Symposium on Operating Systems Principles available
51 titled
52 <a href="https://www.usenix.org/conference/atc16/technical-sessions/presentation/curtsinger">Coz:
53 finding code that counts with causal profiling</a>.</p>
54
55 <p><a href="https://github.com/plasma-umass/coz">The source code</a>
56 for Coz is available from github. It will only build with clang
57 because it uses a
58 <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55606">C++
59 feature missing in GCC</a>, but I've submitted
60 <a href="https://github.com/plasma-umass/coz/pull/67">a patch to solve
61 it</a> and hope it will be included in the upstream source soon.</p>
62
63 <p>Please get in touch if you, like me, would like to see this piece
64 of software in Debian. I would very much like some help with the
65 packaging effort, as I lack the in depth knowledge on how to package
66 C++ libraries.</p>