Path: blob/master/tools/perf/Documentation/perf-daemon.txt
26282 views
perf-daemon(1)1==============234NAME5----6perf-daemon - Run record sessions on background789SYNOPSIS10--------11[verse]12'perf daemon'13'perf daemon' [<options>]14'perf daemon start' [<options>]15'perf daemon stop' [<options>]16'perf daemon signal' [<options>]17'perf daemon ping' [<options>]181920DESCRIPTION21-----------22This command allows to run simple daemon process that starts and23monitors configured record sessions.2425You can imagine 'perf daemon' of background process with several26'perf record' child tasks, like:2728# ps axjf29...301 916507 ... perf daemon start31916507 916508 ... \_ perf record --control=fifo:control,ack -m 10M -e cycles --overwrite --switch-output -a32916507 916509 ... \_ perf record --control=fifo:control,ack -m 20M -e sched:* --overwrite --switch-output -a3334Not every 'perf record' session is suitable for running under daemon.35User need perf session that either produces data on query, like the36flight recorder sessions in above example or session that is configured37to produce data periodically, like with --switch-output configuration38for time and size.3940Each session is started with control setup (with perf record --control41options).4243Sessions are configured through config file, see CONFIG FILE section44with EXAMPLES.454647OPTIONS48-------49-v::50--verbose::51Be more verbose.5253--config=<PATH>::54Config file path. If not provided, perf will check system and default55locations (/etc/perfconfig, $HOME/.perfconfig).5657--base=<PATH>::58Base directory path. Each daemon instance is running on top59of base directory. Only one instance of server can run on60top of one directory at the time.6162All generic options are available also under commands.636465START COMMAND66-------------67The start command creates the daemon process.6869-f::70--foreground::71Do not put the process in background.727374STOP COMMAND75------------76The stop command stops all the session and the daemon process.777879SIGNAL COMMAND80--------------81The signal command sends signal to configured sessions.8283--session::84Send signal to specific session.858687PING COMMAND88------------89The ping command sends control ping to configured sessions.9091--session::92Send ping to specific session.939495CONFIG FILE96-----------97The daemon is configured within standard perf config file by98following new variables:99100daemon.base:101Base path for daemon data. All sessions data are102stored under this path.103104session-<NAME>.run:105Defines new record session. The value is record's command106line without the 'record' keyword.107108Each perf record session is run in daemon.base/<NAME> directory.109110111EXAMPLES112--------113Example with 2 record sessions:114115# cat ~/.perfconfig116[daemon]117base=/opt/perfdata118119[session-cycles]120run = -m 10M -e cycles --overwrite --switch-output -a121122[session-sched]123run = -m 20M -e sched:* --overwrite --switch-output -a124125126Starting the daemon:127128# perf daemon start129130131Check sessions:132133# perf daemon134[603349:daemon] base: /opt/perfdata135[603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a136[603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a137138First line is daemon process info with configured daemon base.139140141Check sessions with more info:142143# perf daemon -v144[603349:daemon] base: /opt/perfdata145output: /opt/perfdata/output146lock: /opt/perfdata/lock147up: 1 minutes148[603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a149base: /opt/perfdata/session-cycles150output: /opt/perfdata/session-cycles/output151control: /opt/perfdata/session-cycles/control152ack: /opt/perfdata/session-cycles/ack153up: 1 minutes154[603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a155base: /opt/perfdata/session-sched156output: /opt/perfdata/session-sched/output157control: /opt/perfdata/session-sched/control158ack: /opt/perfdata/session-sched/ack159up: 1 minutes160161The 'base' path is daemon/session base.162The 'lock' file is daemon's lock file guarding that no other163daemon is running on top of the base.164The 'output' file is perf record output for specific session.165The 'control' and 'ack' files are perf control files.166The 'up' number shows minutes daemon/session is running.167168169Make sure control session is online:170171# perf daemon ping172OK cycles173OK sched174175176Send USR2 signal to session 'cycles' to generate perf.data file:177178# perf daemon signal --session cycles179signal 12 sent to session 'cycles [603452]'180181# tail -2 /opt/perfdata/session-cycles/output182[ perf record: dump data: Woken up 1 times ]183[ perf record: Dump perf.data.2020123017013149 ]184185186Send USR2 signal to all sessions:187188# perf daemon signal189signal 12 sent to session 'cycles [603452]'190signal 12 sent to session 'sched [603453]'191192# tail -2 /opt/perfdata/session-cycles/output193[ perf record: dump data: Woken up 1 times ]194[ perf record: Dump perf.data.2020123017024689 ]195# tail -2 /opt/perfdata/session-sched/output196[ perf record: dump data: Woken up 1 times ]197[ perf record: Dump perf.data.2020123017024713 ]198199200Stop daemon:201202# perf daemon stop203204205SEE ALSO206--------207linkperf:perf-record[1], linkperf:perf-config[1]208209210