summaryrefslogtreecommitdiff
path: root/tools/perf/Documentation/perf-daemon.txt
blob: f558f8e4bc9b9d1abe687fad7f8a5dabbee5bd8b (plain)
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
perf-daemon(1)
==============


NAME
----
perf-daemon - Run record sessions on background


SYNOPSIS
--------
[verse]
'perf daemon'
'perf daemon' [<options>]
'perf daemon start'  [<options>]
'perf daemon stop'   [<options>]
'perf daemon signal' [<options>]
'perf daemon ping'   [<options>]


DESCRIPTION
-----------
This command allows to run simple daemon process that starts and
monitors configured record sessions.

You can imagine 'perf daemon' of background process with several
'perf record' child tasks, like:

  # ps axjf
  ...
       1  916507 ... perf daemon start
  916507  916508 ...  \_ perf record --control=fifo:control,ack -m 10M -e cycles --overwrite --switch-output -a
  916507  916509 ...  \_ perf record --control=fifo:control,ack -m 20M -e sched:* --overwrite --switch-output -a

Not every 'perf record' session is suitable for running under daemon.
User need perf session that either produces data on query, like the
flight recorder sessions in above example or session that is configured
to produce data periodically, like with --switch-output configuration
for time and size.

Each session is started with control setup (with perf record --control
options).

Sessions are configured through config file, see CONFIG FILE section
with EXAMPLES.


OPTIONS
-------
-v::
--verbose::
	Be more verbose.

--config=<PATH>::
	Config file path. If not provided, perf will check system and default
	locations (/etc/perfconfig, $HOME/.perfconfig).

--base=<PATH>::
	Base directory path. Each daemon instance is running on top
	of base directory. Only one instance of server can run on
	top of one directory at the time.

All generic options are available also under commands.


START COMMAND
-------------
The start command creates the daemon process.

-f::
--foreground::
	Do not put the process in background.


STOP COMMAND
------------
The stop command stops all the session and the daemon process.


SIGNAL COMMAND
--------------
The signal command sends signal to configured sessions.

--session::
	Send signal to specific session.


PING COMMAND
------------
The ping command sends control ping to configured sessions.

--session::
	Send ping to specific session.


CONFIG FILE
-----------
The daemon is configured within standard perf config file by
following new variables:

daemon.base:
	Base path for daemon data. All sessions data are
	stored under this path.

session-<NAME>.run:
	Defines new record session. The value is record's command
	line without the 'record' keyword.

Each perf record session is run in daemon.base/<NAME> directory.


EXAMPLES
--------
Example with 2 record sessions:

  # cat ~/.perfconfig
  [daemon]
  base=/opt/perfdata

  [session-cycles]
  run = -m 10M -e cycles --overwrite --switch-output -a

  [session-sched]
  run = -m 20M -e sched:* --overwrite --switch-output -a


Starting the daemon:

  # perf daemon start


Check sessions:

  # perf daemon
  [603349:daemon] base: /opt/perfdata
  [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
  [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a

First line is daemon process info with configured daemon base.


Check sessions with more info:

  # perf daemon -v
  [603349:daemon] base: /opt/perfdata
    output:  /opt/perfdata/output
    lock:    /opt/perfdata/lock
    up:      1 minutes
  [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
    base:    /opt/perfdata/session-cycles
    output:  /opt/perfdata/session-cycles/output
    control: /opt/perfdata/session-cycles/control
    ack:     /opt/perfdata/session-cycles/ack
    up:      1 minutes
  [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
    base:    /opt/perfdata/session-sched
    output:  /opt/perfdata/session-sched/output
    control: /opt/perfdata/session-sched/control
    ack:     /opt/perfdata/session-sched/ack
    up:      1 minutes

The 'base' path is daemon/session base.
The 'lock' file is daemon's lock file guarding that no other
daemon is running on top of the base.
The 'output' file is perf record output for specific session.
The 'control' and 'ack' files are perf control files.
The 'up' number shows minutes daemon/session is running.


Make sure control session is online:

  # perf daemon ping
  OK   cycles
  OK   sched


Send USR2 signal to session 'cycles' to generate perf.data file:

  # perf daemon signal --session cycles
  signal 12 sent to session 'cycles [603452]'

  # tail -2  /opt/perfdata/session-cycles/output
  [ perf record: dump data: Woken up 1 times ]
  [ perf record: Dump perf.data.2020123017013149 ]


Send USR2 signal to all sessions:

  # perf daemon signal
  signal 12 sent to session 'cycles [603452]'
  signal 12 sent to session 'sched [603453]'

  # tail -2  /opt/perfdata/session-cycles/output
  [ perf record: dump data: Woken up 1 times ]
  [ perf record: Dump perf.data.2020123017024689 ]
  # tail -2  /opt/perfdata/session-sched/output
  [ perf record: dump data: Woken up 1 times ]
  [ perf record: Dump perf.data.2020123017024713 ]


Stop daemon:

  # perf daemon stop


SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-config[1]