0001 perf-daemon(1)
0002 ==============
0003
0004
0005 NAME
0006 ----
0007 perf-daemon - Run record sessions on background
0008
0009
0010 SYNOPSIS
0011 --------
0012 [verse]
0013 'perf daemon'
0014 'perf daemon' [<options>]
0015 'perf daemon start' [<options>]
0016 'perf daemon stop' [<options>]
0017 'perf daemon signal' [<options>]
0018 'perf daemon ping' [<options>]
0019
0020
0021 DESCRIPTION
0022 -----------
0023 This command allows to run simple daemon process that starts and
0024 monitors configured record sessions.
0025
0026 You can imagine 'perf daemon' of background process with several
0027 'perf record' child tasks, like:
0028
0029 # ps axjf
0030 ...
0031 1 916507 ... perf daemon start
0032 916507 916508 ... \_ perf record --control=fifo:control,ack -m 10M -e cycles --overwrite --switch-output -a
0033 916507 916509 ... \_ perf record --control=fifo:control,ack -m 20M -e sched:* --overwrite --switch-output -a
0034
0035 Not every 'perf record' session is suitable for running under daemon.
0036 User need perf session that either produces data on query, like the
0037 flight recorder sessions in above example or session that is configured
0038 to produce data periodically, like with --switch-output configuration
0039 for time and size.
0040
0041 Each session is started with control setup (with perf record --control
0042 options).
0043
0044 Sessions are configured through config file, see CONFIG FILE section
0045 with EXAMPLES.
0046
0047
0048 OPTIONS
0049 -------
0050 -v::
0051 --verbose::
0052 Be more verbose.
0053
0054 --config=<PATH>::
0055 Config file path. If not provided, perf will check system and default
0056 locations (/etc/perfconfig, $HOME/.perfconfig).
0057
0058 --base=<PATH>::
0059 Base directory path. Each daemon instance is running on top
0060 of base directory. Only one instance of server can run on
0061 top of one directory at the time.
0062
0063 All generic options are available also under commands.
0064
0065
0066 START COMMAND
0067 -------------
0068 The start command creates the daemon process.
0069
0070 -f::
0071 --foreground::
0072 Do not put the process in background.
0073
0074
0075 STOP COMMAND
0076 ------------
0077 The stop command stops all the session and the daemon process.
0078
0079
0080 SIGNAL COMMAND
0081 --------------
0082 The signal command sends signal to configured sessions.
0083
0084 --session::
0085 Send signal to specific session.
0086
0087
0088 PING COMMAND
0089 ------------
0090 The ping command sends control ping to configured sessions.
0091
0092 --session::
0093 Send ping to specific session.
0094
0095
0096 CONFIG FILE
0097 -----------
0098 The daemon is configured within standard perf config file by
0099 following new variables:
0100
0101 daemon.base:
0102 Base path for daemon data. All sessions data are
0103 stored under this path.
0104
0105 session-<NAME>.run:
0106 Defines new record session. The value is record's command
0107 line without the 'record' keyword.
0108
0109 Each perf record session is run in daemon.base/<NAME> directory.
0110
0111
0112 EXAMPLES
0113 --------
0114 Example with 2 record sessions:
0115
0116 # cat ~/.perfconfig
0117 [daemon]
0118 base=/opt/perfdata
0119
0120 [session-cycles]
0121 run = -m 10M -e cycles --overwrite --switch-output -a
0122
0123 [session-sched]
0124 run = -m 20M -e sched:* --overwrite --switch-output -a
0125
0126
0127 Starting the daemon:
0128
0129 # perf daemon start
0130
0131
0132 Check sessions:
0133
0134 # perf daemon
0135 [603349:daemon] base: /opt/perfdata
0136 [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
0137 [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
0138
0139 First line is daemon process info with configured daemon base.
0140
0141
0142 Check sessions with more info:
0143
0144 # perf daemon -v
0145 [603349:daemon] base: /opt/perfdata
0146 output: /opt/perfdata/output
0147 lock: /opt/perfdata/lock
0148 up: 1 minutes
0149 [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
0150 base: /opt/perfdata/session-cycles
0151 output: /opt/perfdata/session-cycles/output
0152 control: /opt/perfdata/session-cycles/control
0153 ack: /opt/perfdata/session-cycles/ack
0154 up: 1 minutes
0155 [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
0156 base: /opt/perfdata/session-sched
0157 output: /opt/perfdata/session-sched/output
0158 control: /opt/perfdata/session-sched/control
0159 ack: /opt/perfdata/session-sched/ack
0160 up: 1 minutes
0161
0162 The 'base' path is daemon/session base.
0163 The 'lock' file is daemon's lock file guarding that no other
0164 daemon is running on top of the base.
0165 The 'output' file is perf record output for specific session.
0166 The 'control' and 'ack' files are perf control files.
0167 The 'up' number shows minutes daemon/session is running.
0168
0169
0170 Make sure control session is online:
0171
0172 # perf daemon ping
0173 OK cycles
0174 OK sched
0175
0176
0177 Send USR2 signal to session 'cycles' to generate perf.data file:
0178
0179 # perf daemon signal --session cycles
0180 signal 12 sent to session 'cycles [603452]'
0181
0182 # tail -2 /opt/perfdata/session-cycles/output
0183 [ perf record: dump data: Woken up 1 times ]
0184 [ perf record: Dump perf.data.2020123017013149 ]
0185
0186
0187 Send USR2 signal to all sessions:
0188
0189 # perf daemon signal
0190 signal 12 sent to session 'cycles [603452]'
0191 signal 12 sent to session 'sched [603453]'
0192
0193 # tail -2 /opt/perfdata/session-cycles/output
0194 [ perf record: dump data: Woken up 1 times ]
0195 [ perf record: Dump perf.data.2020123017024689 ]
0196 # tail -2 /opt/perfdata/session-sched/output
0197 [ perf record: dump data: Woken up 1 times ]
0198 [ perf record: Dump perf.data.2020123017024713 ]
0199
0200
0201 Stop daemon:
0202
0203 # perf daemon stop
0204
0205
0206 SEE ALSO
0207 --------
0208 linkperf:perf-record[1], linkperf:perf-config[1]