209 lines · plain
1perf-daemon(1)2==============3 4 5NAME6----7perf-daemon - Run record sessions on background8 9 10SYNOPSIS11--------12[verse]13'perf daemon'14'perf daemon' [<options>]15'perf daemon start' [<options>]16'perf daemon stop' [<options>]17'perf daemon signal' [<options>]18'perf daemon ping' [<options>]19 20 21DESCRIPTION22-----------23This command allows to run simple daemon process that starts and24monitors configured record sessions.25 26You can imagine 'perf daemon' of background process with several27'perf record' child tasks, like:28 29 # ps axjf30 ...31 1 916507 ... perf daemon start32 916507 916508 ... \_ perf record --control=fifo:control,ack -m 10M -e cycles --overwrite --switch-output -a33 916507 916509 ... \_ perf record --control=fifo:control,ack -m 20M -e sched:* --overwrite --switch-output -a34 35Not every 'perf record' session is suitable for running under daemon.36User need perf session that either produces data on query, like the37flight recorder sessions in above example or session that is configured38to produce data periodically, like with --switch-output configuration39for time and size.40 41Each session is started with control setup (with perf record --control42options).43 44Sessions are configured through config file, see CONFIG FILE section45with EXAMPLES.46 47 48OPTIONS49-------50-v::51--verbose::52 Be more verbose.53 54--config=<PATH>::55 Config file path. If not provided, perf will check system and default56 locations (/etc/perfconfig, $HOME/.perfconfig).57 58--base=<PATH>::59 Base directory path. Each daemon instance is running on top60 of base directory. Only one instance of server can run on61 top of one directory at the time.62 63All generic options are available also under commands.64 65 66START COMMAND67-------------68The start command creates the daemon process.69 70-f::71--foreground::72 Do not put the process in background.73 74 75STOP COMMAND76------------77The stop command stops all the session and the daemon process.78 79 80SIGNAL COMMAND81--------------82The signal command sends signal to configured sessions.83 84--session::85 Send signal to specific session.86 87 88PING COMMAND89------------90The ping command sends control ping to configured sessions.91 92--session::93 Send ping to specific session.94 95 96CONFIG FILE97-----------98The daemon is configured within standard perf config file by99following new variables:100 101daemon.base:102 Base path for daemon data. All sessions data are103 stored under this path.104 105session-<NAME>.run:106 Defines new record session. The value is record's command107 line without the 'record' keyword.108 109Each perf record session is run in daemon.base/<NAME> directory.110 111 112EXAMPLES113--------114Example with 2 record sessions:115 116 # cat ~/.perfconfig117 [daemon]118 base=/opt/perfdata119 120 [session-cycles]121 run = -m 10M -e cycles --overwrite --switch-output -a122 123 [session-sched]124 run = -m 20M -e sched:* --overwrite --switch-output -a125 126 127Starting the daemon:128 129 # perf daemon start130 131 132Check sessions:133 134 # perf daemon135 [603349:daemon] base: /opt/perfdata136 [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a137 [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a138 139First line is daemon process info with configured daemon base.140 141 142Check sessions with more info:143 144 # perf daemon -v145 [603349:daemon] base: /opt/perfdata146 output: /opt/perfdata/output147 lock: /opt/perfdata/lock148 up: 1 minutes149 [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a150 base: /opt/perfdata/session-cycles151 output: /opt/perfdata/session-cycles/output152 control: /opt/perfdata/session-cycles/control153 ack: /opt/perfdata/session-cycles/ack154 up: 1 minutes155 [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a156 base: /opt/perfdata/session-sched157 output: /opt/perfdata/session-sched/output158 control: /opt/perfdata/session-sched/control159 ack: /opt/perfdata/session-sched/ack160 up: 1 minutes161 162The 'base' path is daemon/session base.163The 'lock' file is daemon's lock file guarding that no other164daemon is running on top of the base.165The 'output' file is perf record output for specific session.166The 'control' and 'ack' files are perf control files.167The 'up' number shows minutes daemon/session is running.168 169 170Make sure control session is online:171 172 # perf daemon ping173 OK cycles174 OK sched175 176 177Send USR2 signal to session 'cycles' to generate perf.data file:178 179 # perf daemon signal --session cycles180 signal 12 sent to session 'cycles [603452]'181 182 # tail -2 /opt/perfdata/session-cycles/output183 [ perf record: dump data: Woken up 1 times ]184 [ perf record: Dump perf.data.2020123017013149 ]185 186 187Send USR2 signal to all sessions:188 189 # perf daemon signal190 signal 12 sent to session 'cycles [603452]'191 signal 12 sent to session 'sched [603453]'192 193 # tail -2 /opt/perfdata/session-cycles/output194 [ perf record: dump data: Woken up 1 times ]195 [ perf record: Dump perf.data.2020123017024689 ]196 # tail -2 /opt/perfdata/session-sched/output197 [ perf record: dump data: Woken up 1 times ]198 [ perf record: Dump perf.data.2020123017024713 ]199 200 201Stop daemon:202 203 # perf daemon stop204 205 206SEE ALSO207--------208linkperf:perf-record[1], linkperf:perf-config[1]209