File: profiling.page

package info (click to toggle)
sysprof 48.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 8,924 kB
  • sloc: ansic: 72,988; xml: 168; cpp: 49; sh: 34; makefile: 26
file content (112 lines) | stat: -rw-r--r-- 4,467 bytes parent folder | download
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
<page xmlns="http://projectmallard.org/1.0/"
      xmlns:its="http://www.w3.org/2005/11/its"
      type="topic"
      id="profiling">
    <info>
      <link type="guide" xref="index#profiling"/>
    </info>
    <title>Profiling</title>
  <section id="system-profiling">
    <title>How to profile your system</title>
    <p>When <app>Sysprof</app> profiles your system, it records stack
information for all applications executing, including the Linux kernel. This
can sometimes be confusing if you only want to look at a single process.  If
your application does not interact much with the host system, you may have more
success by using <app>Sysprof</app> to
<link href="profiling#new-process-profiling">spawn a new process</link>.</p>

    <p>To profile your entire system, ensure the target button is set to
<em>All Processes</em> and click <em>Record</em>.</p>

    <p>At this point, you may be asked to <em>authorize</em> access to
profile the system. This is required as the Linux kernel's perf
implementation requires root to perform whole-system profiling.</p>

    <p>During the profiling session, you will see the number of
seconds the profile has been active. Clicking the <em>Record</em>
button again will stop the profiling session. Afterwhich, the callgraph
will be displayed.</p>

    <note>
      <p>If you find that the <app>sysprof</app> application is showing up in
your profiling callgraph, you might consider recording the profiling session
with <cmd>sysprof-cli</cmd>. This is a command line program that will capture
your profiling session to disk to be viewed at a later time.</p>
    </note>

    <p>See <link href="profiling#interpreting-results">interpreting
results</link> for more guidance.</p>

  </section>

  <section id="new-process-profiling">
    <info>
      <link type="guide" xref="index#profiling"/>
    </info>
    <title>Profile a new process</title>

    <p>Often times, you may need to spawn a new process to profile.
First, select the <em>Application</em> button next at the top of the
recording window. Fill in your command and working directory, and optionally
specify any environment variables you need. Your process will be started
when recording begins.</p>

    <note>
      <p>If you are spawning a process that requires access to your current
display, such as a GTK+ application, you will want to make sure <em>Inherit
current environment</em> is set.</p>
    </note>

  </section>

  <section id="sysprof-cli">
    <info>
      <link type="guide" xref="index#profiling"/>
    </info>
    <title>Profiling with the sysprof-cli command line tool</title>

    <p>For minimal overhead, you might consider using the <cmd>sysprof-cli</cmd>
command line tool. When run without any arguments, it will record your entire
system and save the output to <file>capture.syscap</file>. This file can be
opened with the <app>Sysprof</app> application to view the callgraph.</p>

    <p>If you would like to spawn a new process, use <cmd>sysprof-cli --
'command'</cmd> to specify a command to be launched. The command will inherit
the current environment.</p>

  </section>

  <section id="interpreting-results">
    <info>
      <link type="guide" xref="index#profiling"/>
    </info>
    <title>Interpreting results</title>

    <p>The profiling results in <app>Sysprof</app> are split into three
sections. On the top left is a list of all the functions profiled. They
are sorted by how often they were called during the recording.</p>

    <note>
      <p>It is important to note that the amount of time spent in each function
is not captured. That would require a tracing profiler to accurately record.
The percentage is calculated by determining how often that function showed
up in the current stacktrace when a sample was recorded.</p>
    </note>

    <p>After selecting a function from the functions list, all of the recorded
callers of that function will be displayed on the bottom left. They are also
sorted by the percentage of samples that included that function in the
stacktrace.</p>

    <p>On the right, are all of the decendants of a selected function. You can
select a function either from the functions list, or the callers list.</p>

    <note>
      <p>If you see <em>- - Context Switch - -</em> in your results, that means that the
application transitioned into or from the Linux kernel. There can be many reasons
for this such as a <em>syscall</em> or <em>signal</em>.</p>
    </note>

  </section>

</page>