-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProfilingOverview.html
225 lines (182 loc) · 11.7 KB
/
ProfilingOverview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Profiling Overview</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css?v=fadd4351" />
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=77160d70" />
<script src="_static/documentation_options.js?v=a8da1a53"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Mantid Timers" href="Timers.html" />
<link rel="prev" title="Work flows algorithm profiling" href="AlgorithmProfiler.html" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59110517-1', 'auto');
ga('send', 'pageview');
</script>
</head><body>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.mantidproject.org">
</a>
<span class="navbar-text navbar-version pull-left"><b>main</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="divider-vertical"></li>
<li><a href="index.html">Home</a></li>
<li><a href="https://download.mantidproject.org">Download</a></li>
<li><a href="https://docs.mantidproject.org">User Documentation</a></li>
<li><a href="http://www.mantidproject.org/contact">Contact Us</a></li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<p>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="index.html">Documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">Profiling Overview</a></li>
</ul>
</div> </p>
</div>
<div class="container">
<div class="row">
<div class="body col-md-12 content" role="main">
<section id="profiling-overview">
<span id="profilingoverview"></span><h1>Profiling Overview<a class="headerlink" href="#profiling-overview" title="Link to this heading">¶</a></h1>
<nav class="contents local" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#profiling-in-python" id="id1">Profiling in Python</a></p>
<ul>
<li><p><a class="reference internal" href="#profiling-with-cprofile" id="id2">Profiling with cProfile</a></p></li>
<li><p><a class="reference internal" href="#profiling-with-yappi" id="id3">Profiling with Yappi</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#profiling-in-c" id="id4">Profiling in C++</a></p>
<ul>
<li><p><a class="reference internal" href="#mantid-s-algorithm-profiler" id="id5">Mantid’s Algorithm Profiler</a></p></li>
<li><p><a class="reference internal" href="#other-profiling-tools" id="id6">Other Profiling Tools</a></p>
<ul>
<li><p><a class="reference internal" href="#linux" id="id7">Linux</a></p></li>
<li><p><a class="reference internal" href="#windows" id="id8">Windows</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#timing-in-c" id="id9">Timing in C++</a></p></li>
</ul>
</li>
</ul>
</nav>
<p>Profiling can mean a few different things, so here are the current ways!
Many of these work only on certain platforms and this document will note the limitations.
Tools that are noted as being supported in linux are likely to work in osx as well.
Most of these approaches are specific to a single language.</p>
<section id="profiling-in-python">
<h2><a class="toc-backref" href="#id1" role="doc-backlink">Profiling in Python</a><a class="headerlink" href="#profiling-in-python" title="Link to this heading">¶</a></h2>
<section id="profiling-with-cprofile">
<h3><a class="toc-backref" href="#id2" role="doc-backlink">Profiling with cProfile</a><a class="headerlink" href="#profiling-with-cprofile" title="Link to this heading">¶</a></h3>
<p>Mantid supports profiling of its underlying code using the <a class="reference external" href="https://docs.python.org/3/library/profile.html">cProfile</a> module from python.</p>
<p>Launch Mantid Workbench from the command line using the script in the installation folder, adding the <code class="docutils literal notranslate"><span class="pre">--profile</span></code> modifier with a path to the output file.</p>
<p>E.g: <code class="docutils literal notranslate"><span class="pre">path/to/install/bin/workbench</span> <span class="pre">--profile</span> <span class="pre">path/to/outputFile.prof</span></code></p>
<p>This profile can then either be sent to the developers upon request or be analysed using the python module <a class="reference external" href="https://pypi.org/project/snakeviz/">snakeviz</a>.</p>
</section>
<section id="profiling-with-yappi">
<h3><a class="toc-backref" href="#id3" role="doc-backlink">Profiling with Yappi</a><a class="headerlink" href="#profiling-with-yappi" title="Link to this heading">¶</a></h3>
<p>cProfile can only profile the current thread, this makes it useful for diagnosing PyQt performance issues (such as random hangs when a user does something), but poor for diagnosing workflow algorithm issues.</p>
<p><a class="reference external" href="https://pypi.org/project/yappi/">Yappi (Yet Another Python Profiler)</a> is multithreading aware. cProfile which will show everything up to the exec, or run call. Yappi will profile the thread and show any slow points within the separate thread.</p>
<p><em>Note: This will not work with QThreads and may crash or be unable to profile inside. It is recommended you migrate workers by inheriting from IQtAsync, see ``async_qt_adaptor.py`` for details.
Using native threading enables tooling, makes testing simple and produces readable stack traces.</em></p>
<p>To use Yappi instead of cProfile simple append <cite>–yappi</cite> to the list of arguments after profile, e.g.:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># If you do not have yappi installed</span>
python3<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>yappi<span class="w"> </span>--user
<span class="c1"># Run with Yappi profiler</span>
./MantidWorkbench<span class="w"> </span>--profile<span class="w"> </span>name_of_profile.out<span class="w"> </span>--yappi
</pre></div>
</div>
<p>KCachegrind can be used to view profiling data, see <a class="reference internal" href="ProfilingWithValgrind.html"><span class="doc">Profiling with Valgrind</span></a> for more details on usage.</p>
</section>
</section>
<section id="profiling-in-c">
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Profiling in C++</a><a class="headerlink" href="#profiling-in-c" title="Link to this heading">¶</a></h2>
<section id="mantid-s-algorithm-profiler">
<h3><a class="toc-backref" href="#id5" role="doc-backlink">Mantid’s Algorithm Profiler</a><a class="headerlink" href="#mantid-s-algorithm-profiler" title="Link to this heading">¶</a></h3>
<p>On Linux, the build can be configured to generate algorithm profiling information. See <a class="reference internal" href="AlgorithmProfiler.html"><span class="doc">AlgorithmProfiler</span></a> for details.</p>
</section>
<section id="other-profiling-tools">
<h3><a class="toc-backref" href="#id6" role="doc-backlink">Other Profiling Tools</a><a class="headerlink" href="#other-profiling-tools" title="Link to this heading">¶</a></h3>
<section id="linux">
<span id="linux-1"></span><h4><a class="toc-backref" href="#id7" role="doc-backlink">Linux</a><a class="headerlink" href="#linux" title="Link to this heading">¶</a></h4>
<p><a class="reference internal" href="ProfilingWithPerf.html"><span class="doc">Profiling with perf</span></a> for details on perf and intel’s vtune</p>
<p><a class="reference internal" href="ProfilingWithValgrind.html"><span class="doc">Profiling with Valgrind</span></a> for details on using this tool</p>
<p><a class="reference external" href="http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindIndex">Callgrind/KCachegrind</a></p>
<ul class="simple">
<li><p>KCachegrind visualizes callgrind output.</p></li>
<li><p>See <a class="reference internal" href="ProfilingWithValgrind.html#profilingwithvalgrind"><span class="std std-ref">Profiling With Valgrind</span></a> for help on
running callgrind</p></li>
</ul>
<p><a class="reference external" href="https://github.com/gperftools/gperftools">gperftools</a></p>
<ul class="simple">
<li><p>Takes snapshot of run and prints percentage of calls in functions</p></li>
</ul>
<p>See here for a list of other tools:
<a class="reference external" href="http://www.pixelbeat.org/programming/profiling/">http://www.pixelbeat.org/programming/profiling/</a></p>
</section>
<section id="windows">
<span id="windows-1"></span><h4><a class="toc-backref" href="#id8" role="doc-backlink">Windows</a><a class="headerlink" href="#windows" title="Link to this heading">¶</a></h4>
<p><a class="reference external" href="http://www.codersnotes.com/sleepy/">Very Sleepy</a>:</p>
<ul class="simple">
<li><p>Start/stop recording of program using a button</p></li>
<li><p>Not as detailed or flexible as callgrind</p></li>
</ul>
</section>
</section>
<section id="timing-in-c">
<h3><a class="toc-backref" href="#id9" role="doc-backlink">Timing in C++</a><a class="headerlink" href="#timing-in-c" title="Link to this heading">¶</a></h3>
<p>Please refer to <a class="reference internal" href="Timers.html"><span class="doc">Mantid Timers</span></a> for an introduction to measuring execution time of the Mantid C++ code.</p>
</section>
</section>
</section>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<ul class="nav navbar-nav" style=" float: right;">
<li>
<a href="AlgorithmProfiler.html" title="Previous Chapter: Work flows algorithm profiling"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« Work flows al...</span>
</a>
</li>
<li>
<a href="Timers.html" title="Next Chapter: Mantid Timers"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Mantid Timers »</span>
</a>
</li>
<li><a href="#">Back to top</a></li>
</ul>
<p>
</p>
</div>
</footer>
</body>
</html>