-
Notifications
You must be signed in to change notification settings - Fork 0
/
Linux-Perf.html
520 lines (406 loc) · 14.6 KB
/
Linux-Perf.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Linux Performance: Existing methods and tools</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<meta name="title" content="Linux Performance: Existing methods and tools"/>
<meta name="generator" content="Org-mode"/>
<meta name="generated" content="2015-03-21 23:33:13 PDT"/>
<meta name="author" content="Manoj Raja Rao"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
html { font-family: Times, serif; font-size: 12pt; }
.title { text-align: center; }
.todo { color: red; }
.done { color: green; }
.tag { background-color: #add8e6; font-weight:normal }
.target { }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.right {margin-left:auto; margin-right:0px; text-align:right;}
.left {margin-left:0px; margin-right:auto; text-align:left;}
.center {margin-left:auto; margin-right:auto; text-align:center;}
p.verse { margin-left: 3% }
pre {
border: 1pt solid #AEBDCC;
background-color: #F3F5F7;
padding: 5pt;
font-family: courier, monospace;
font-size: 90%;
overflow:auto;
}
table { border-collapse: collapse; }
td, th { vertical-align: top; }
th.right { text-align:center; }
th.left { text-align:center; }
th.center { text-align:center; }
td.right { text-align:right; }
td.left { text-align:left; }
td.center { text-align:center; }
dt { font-weight: bold; }
div.figure { padding: 0.5em; }
div.figure p { text-align: center; }
div.inlinetask {
padding:10px;
border:2px solid gray;
margin:10px;
background: #ffffcc;
}
textarea { overflow-x: auto; }
.linenr { font-size:smaller }
.code-highlighted {background-color:#ffff00;}
.org-info-js_info-navigation { border-style:none; }
#org-info-js_console-label { font-size:10px; font-weight:bold;
white-space:nowrap; }
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
font-weight:bold; }
/*]]>*/-->
</style>
<script type="text/javascript">
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="preamble">
</div>
<div id="content">
<h1 class="title">Linux Performance: Existing methods and tools</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Abstract</a></li>
<li><a href="#sec-2">2 Introduction</a></li>
<li><a href="#sec-3">3 A Primer of existing tools</a>
<ul>
<li><a href="#sec-3-1">3.1 ftrace:</a></li>
<li><a href="#sec-3-2">3.2 perf:</a></li>
<li><a href="#sec-3-3">3.3 oprofile:</a></li>
<li><a href="#sec-3-4">3.4 lttng:</a></li>
<li><a href="#sec-3-5">3.5 flamegraphs</a></li>
<li><a href="#sec-3-6">3.6 coldgraphs</a></li>
<li><a href="#sec-3-7">3.7 differential graphs</a></li>
<li><a href="#sec-3-8">3.8 systrace</a></li>
<li><a href="#sec-3-9">3.9 trace-cmd</a></li>
<li><a href="#sec-3-10">3.10 atrace</a></li>
<li><a href="#sec-3-11">3.11 strace</a></li>
<li><a href="#sec-3-12">3.12 dtrace</a></li>
<li><a href="#sec-3-13">3.13 sar</a></li>
<li><a href="#sec-3-14">3.14 iostat</a></li>
<li><a href="#sec-3-15">3.15 vmstat</a></li>
<li><a href="#sec-3-16">3.16 iosnoop</a></li>
<li><a href="#sec-3-17">3.17 sysfs - a treasure house</a></li>
<li><a href="#sec-3-18">3.18 procfs - another treasure house</a></li>
<li><a href="#sec-3-19">3.19 ltrace</a></li>
<li><a href="#sec-3-20">3.20 systemtap</a></li>
<li><a href="#sec-3-21">3.21 ktap</a></li>
<li><a href="#sec-3-22">3.22 mpstat</a></li>
<li><a href="#sec-3-23">3.23 sysstat</a></li>
<li><a href="#sec-3-24">3.24 collectl</a></li>
<li><a href="#sec-3-25">3.25 top</a></li>
<li><a href="#sec-3-26">3.26 htop</a></li>
<li><a href="#sec-3-27">3.27 ps</a></li>
<li><a href="#sec-3-28">3.28 free</a></li>
<li><a href="#sec-3-29">3.29 pidstat</a></li>
<li><a href="#sec-3-30">3.30 sar</a></li>
</ul>
</li>
<li><a href="#sec-4">4 </a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-3">
<h3 id="sec-1"><span class="section-number-3">1</span> Abstract</h3>
<div class="outline-text-3" id="text-1">
<p> A number of tools and methods exist to measure performance on Linux
with varying capabilities and applications. From user space
applications to kernel or even bare metals hardware evaluation. We
propose to explore, to varying depths, a broad array of tools
available. In particular, we go into the details of a handful of a few
tools listed below. This paper lists the applications of each of these
tools and their relevance to different problems at hand.
</p>
</div>
</div>
<div id="outline-container-2" class="outline-3">
<h3 id="sec-2"><span class="section-number-3">2</span> Introduction</h3>
<div class="outline-text-3" id="text-2">
<p> In this section, we provide a brief motivation for using such tools in a
modern Linux system and attempt to convince the reader that such
tools can tremendously help reduce the overhead in debugging issues
with a system, tuning a system to maximize performance etc.
</p>
</div>
</div>
<div id="outline-container-3" class="outline-3">
<h3 id="sec-3"><span class="section-number-3">3</span> A Primer of existing tools</h3>
<div class="outline-text-3" id="text-3">
</div>
<div id="outline-container-3-1" class="outline-4">
<h4 id="sec-3-1"><span class="section-number-4">3.1</span> ftrace:</h4>
<div class="outline-text-4" id="text-3-1">
<p> Ftrace is a kernel functionality implemented by Steve Rostedt.
</p><ul>
<li id="sec-3-1-1">How is ftrace implemented?<br/>
Add a detailed paragraph about the implementation specifics of
the ftrace implementation.
<ul>
<li>ftrace is a kernel tracing functionality that allows to trace
the order of execution of functions along with information such
as the pid whose context the current function is being called
from, timestamp of the entry etc.
</li>
<li>There are similar functionalities in the user land for debugging via the strace.
ftrace provides an ordered tracing of the functions called in the kernel and can log them in the trace buffer.
As long as the support for tracing exists in kernel traces can be logged and disabled dynamically. This allows the user to log traces on events.
Events are nothing but individual traces.
</li>
<li>ftrace provides an invaluable insight into a running system by
capturing functions/events in the order of their execution.
</li>
<li>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-3-2" class="outline-4">
<h4 id="sec-3-2"><span class="section-number-4">3.2</span> perf:</h4>
<div class="outline-text-4" id="text-3-2">
<ul>
<li>Perf feature was added to the mainline kernel around the 2.6.31
version. This was added to track the values of hardware counters
maintained by the processor to keep track of events such as
cache misses (instruction and data), branch mispredictions
etc. It was also possible to track software events such as page
faults and such. Perf started as a simple low-overhead
functionality to keep track of Linux performance. With time,
several events were added that perf is able to keep track of.
</li>
<li>Perf utility collects various counters from the hardware,
including CPU specific events such as the cache hits, cache
misses, branch mis-predictions, and other similar events.
</li>
<li>Perf top provides a nice interface like the top functionality of
the Linux system. Especially if the kptr<sub>restrict</sub> is set to 0
then the perf utility grabs the kernel's symbols and
dereferences the addresses in run time to show the functions
that are currently being executed. So you have a flashing screen
that shows the list of functions currently being executed on the
system with some statistics such as the number of samples, time
spent in the function etc.
</li>
</ul>
<ul>
<li id="sec-3-2-1">list:<br/>
</li>
</ul>
<ul>
<li id="sec-3-2-2">top:<br/>
</li>
</ul>
<ul>
<li id="sec-3-2-3">record:<br/>
</li>
</ul>
<ul>
<li id="sec-3-2-4">report:<br/>
</li>
</ul>
<ul>
<li id="sec-3-2-5">script:<br/>
</li>
</ul>
<ul>
<li id="sec-3-2-6">stat:<br/>
</li>
</ul>
<ul>
<li id="sec-3-2-7">-rNNN:<br/>
</li>
</ul>
<ul>
<li id="sec-3-2-8">hardware counters:<br/>
</li>
</ul>
</div>
</div>
<div id="outline-container-3-3" class="outline-4">
<h4 id="sec-3-3"><span class="section-number-4">3.3</span> oprofile:</h4>
<div class="outline-text-4" id="text-3-3">
</div>
</div>
<div id="outline-container-3-4" class="outline-4">
<h4 id="sec-3-4"><span class="section-number-4">3.4</span> lttng:</h4>
<div class="outline-text-4" id="text-3-4">
</div>
</div>
<div id="outline-container-3-5" class="outline-4">
<h4 id="sec-3-5"><span class="section-number-4">3.5</span> flamegraphs</h4>
<div class="outline-text-4" id="text-3-5">
</div>
</div>
<div id="outline-container-3-6" class="outline-4">
<h4 id="sec-3-6"><span class="section-number-4">3.6</span> coldgraphs</h4>
<div class="outline-text-4" id="text-3-6">
</div>
</div>
<div id="outline-container-3-7" class="outline-4">
<h4 id="sec-3-7"><span class="section-number-4">3.7</span> differential graphs</h4>
<div class="outline-text-4" id="text-3-7">
</div>
</div>
<div id="outline-container-3-8" class="outline-4">
<h4 id="sec-3-8"><span class="section-number-4">3.8</span> systrace</h4>
<div class="outline-text-4" id="text-3-8">
</div>
</div>
<div id="outline-container-3-9" class="outline-4">
<h4 id="sec-3-9"><span class="section-number-4">3.9</span> trace-cmd</h4>
<div class="outline-text-4" id="text-3-9">
</div>
</div>
<div id="outline-container-3-10" class="outline-4">
<h4 id="sec-3-10"><span class="section-number-4">3.10</span> atrace</h4>
<div class="outline-text-4" id="text-3-10">
</div>
</div>
<div id="outline-container-3-11" class="outline-4">
<h4 id="sec-3-11"><span class="section-number-4">3.11</span> strace</h4>
<div class="outline-text-4" id="text-3-11">
</div>
</div>
<div id="outline-container-3-12" class="outline-4">
<h4 id="sec-3-12"><span class="section-number-4">3.12</span> dtrace</h4>
<div class="outline-text-4" id="text-3-12">
</div>
</div>
<div id="outline-container-3-13" class="outline-4">
<h4 id="sec-3-13"><span class="section-number-4">3.13</span> sar</h4>
<div class="outline-text-4" id="text-3-13">
</div>
</div>
<div id="outline-container-3-14" class="outline-4">
<h4 id="sec-3-14"><span class="section-number-4">3.14</span> iostat</h4>
<div class="outline-text-4" id="text-3-14">
</div>
</div>
<div id="outline-container-3-15" class="outline-4">
<h4 id="sec-3-15"><span class="section-number-4">3.15</span> vmstat</h4>
<div class="outline-text-4" id="text-3-15">
</div>
</div>
<div id="outline-container-3-16" class="outline-4">
<h4 id="sec-3-16"><span class="section-number-4">3.16</span> iosnoop</h4>
<div class="outline-text-4" id="text-3-16">
</div>
</div>
<div id="outline-container-3-17" class="outline-4">
<h4 id="sec-3-17"><span class="section-number-4">3.17</span> sysfs - a treasure house</h4>
<div class="outline-text-4" id="text-3-17">
</div>
</div>
<div id="outline-container-3-18" class="outline-4">
<h4 id="sec-3-18"><span class="section-number-4">3.18</span> procfs - another treasure house</h4>
<div class="outline-text-4" id="text-3-18">
</div>
</div>
<div id="outline-container-3-19" class="outline-4">
<h4 id="sec-3-19"><span class="section-number-4">3.19</span> ltrace</h4>
<div class="outline-text-4" id="text-3-19">
</div>
</div>
<div id="outline-container-3-20" class="outline-4">
<h4 id="sec-3-20"><span class="section-number-4">3.20</span> systemtap</h4>
<div class="outline-text-4" id="text-3-20">
</div>
</div>
<div id="outline-container-3-21" class="outline-4">
<h4 id="sec-3-21"><span class="section-number-4">3.21</span> ktap</h4>
<div class="outline-text-4" id="text-3-21">
</div>
</div>
<div id="outline-container-3-22" class="outline-4">
<h4 id="sec-3-22"><span class="section-number-4">3.22</span> mpstat</h4>
<div class="outline-text-4" id="text-3-22">
</div>
</div>
<div id="outline-container-3-23" class="outline-4">
<h4 id="sec-3-23"><span class="section-number-4">3.23</span> sysstat</h4>
<div class="outline-text-4" id="text-3-23">
</div>
</div>
<div id="outline-container-3-24" class="outline-4">
<h4 id="sec-3-24"><span class="section-number-4">3.24</span> collectl</h4>
<div class="outline-text-4" id="text-3-24">
</div>
</div>
<div id="outline-container-3-25" class="outline-4">
<h4 id="sec-3-25"><span class="section-number-4">3.25</span> top</h4>
<div class="outline-text-4" id="text-3-25">
</div>
</div>
<div id="outline-container-3-26" class="outline-4">
<h4 id="sec-3-26"><span class="section-number-4">3.26</span> htop</h4>
<div class="outline-text-4" id="text-3-26">
</div>
</div>
<div id="outline-container-3-27" class="outline-4">
<h4 id="sec-3-27"><span class="section-number-4">3.27</span> ps</h4>
<div class="outline-text-4" id="text-3-27">
</div>
</div>
<div id="outline-container-3-28" class="outline-4">
<h4 id="sec-3-28"><span class="section-number-4">3.28</span> free</h4>
<div class="outline-text-4" id="text-3-28">
</div>
</div>
<div id="outline-container-3-29" class="outline-4">
<h4 id="sec-3-29"><span class="section-number-4">3.29</span> pidstat</h4>
<div class="outline-text-4" id="text-3-29">
</div>
</div>
<div id="outline-container-3-30" class="outline-4">
<h4 id="sec-3-30"><span class="section-number-4">3.30</span> sar</h4>
<div class="outline-text-4" id="text-3-30">
</div>
</div>
</div>
<div id="outline-container-4" class="outline-3">
<h3 id="sec-4"><span class="section-number-3">4</span> </h3>
<div class="outline-text-3" id="text-4">
</div>
</div>
</div>
<div id="postamble">
<p class="date">Date: 2015-03-21 23:33:13 PDT</p>
<p class="author">Author: Manoj Raja Rao</p>
<p class="creator">Org version 7.8.11 with Emacs version 24</p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
</div>
</body>
</html>