perf-daemon.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. perf-daemon(1)
  2. ==============
  3. NAME
  4. ----
  5. perf-daemon - Run record sessions on background
  6. SYNOPSIS
  7. --------
  8. [verse]
  9. 'perf daemon'
  10. 'perf daemon' [<options>]
  11. 'perf daemon start' [<options>]
  12. 'perf daemon stop' [<options>]
  13. 'perf daemon signal' [<options>]
  14. 'perf daemon ping' [<options>]
  15. DESCRIPTION
  16. -----------
  17. This command allows to run simple daemon process that starts and
  18. monitors configured record sessions.
  19. You can imagine 'perf daemon' of background process with several
  20. 'perf record' child tasks, like:
  21. # ps axjf
  22. ...
  23. 1 916507 ... perf daemon start
  24. 916507 916508 ... \_ perf record --control=fifo:control,ack -m 10M -e cycles --overwrite --switch-output -a
  25. 916507 916509 ... \_ perf record --control=fifo:control,ack -m 20M -e sched:* --overwrite --switch-output -a
  26. Not every 'perf record' session is suitable for running under daemon.
  27. User need perf session that either produces data on query, like the
  28. flight recorder sessions in above example or session that is configured
  29. to produce data periodically, like with --switch-output configuration
  30. for time and size.
  31. Each session is started with control setup (with perf record --control
  32. options).
  33. Sessions are configured through config file, see CONFIG FILE section
  34. with EXAMPLES.
  35. OPTIONS
  36. -------
  37. -v::
  38. --verbose::
  39. Be more verbose.
  40. --config=<PATH>::
  41. Config file path. If not provided, perf will check system and default
  42. locations (/etc/perfconfig, $HOME/.perfconfig).
  43. --base=<PATH>::
  44. Base directory path. Each daemon instance is running on top
  45. of base directory. Only one instance of server can run on
  46. top of one directory at the time.
  47. All generic options are available also under commands.
  48. START COMMAND
  49. -------------
  50. The start command creates the daemon process.
  51. -f::
  52. --foreground::
  53. Do not put the process in background.
  54. STOP COMMAND
  55. ------------
  56. The stop command stops all the session and the daemon process.
  57. SIGNAL COMMAND
  58. --------------
  59. The signal command sends signal to configured sessions.
  60. --session::
  61. Send signal to specific session.
  62. PING COMMAND
  63. ------------
  64. The ping command sends control ping to configured sessions.
  65. --session::
  66. Send ping to specific session.
  67. CONFIG FILE
  68. -----------
  69. The daemon is configured within standard perf config file by
  70. following new variables:
  71. daemon.base:
  72. Base path for daemon data. All sessions data are
  73. stored under this path.
  74. session-<NAME>.run:
  75. Defines new record session. The value is record's command
  76. line without the 'record' keyword.
  77. Each perf record session is run in daemon.base/<NAME> directory.
  78. EXAMPLES
  79. --------
  80. Example with 2 record sessions:
  81. # cat ~/.perfconfig
  82. [daemon]
  83. base=/opt/perfdata
  84. [session-cycles]
  85. run = -m 10M -e cycles --overwrite --switch-output -a
  86. [session-sched]
  87. run = -m 20M -e sched:* --overwrite --switch-output -a
  88. Starting the daemon:
  89. # perf daemon start
  90. Check sessions:
  91. # perf daemon
  92. [603349:daemon] base: /opt/perfdata
  93. [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
  94. [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
  95. First line is daemon process info with configured daemon base.
  96. Check sessions with more info:
  97. # perf daemon -v
  98. [603349:daemon] base: /opt/perfdata
  99. output: /opt/perfdata/output
  100. lock: /opt/perfdata/lock
  101. up: 1 minutes
  102. [603350:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
  103. base: /opt/perfdata/session-cycles
  104. output: /opt/perfdata/session-cycles/output
  105. control: /opt/perfdata/session-cycles/control
  106. ack: /opt/perfdata/session-cycles/ack
  107. up: 1 minutes
  108. [603351:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
  109. base: /opt/perfdata/session-sched
  110. output: /opt/perfdata/session-sched/output
  111. control: /opt/perfdata/session-sched/control
  112. ack: /opt/perfdata/session-sched/ack
  113. up: 1 minutes
  114. The 'base' path is daemon/session base.
  115. The 'lock' file is daemon's lock file guarding that no other
  116. daemon is running on top of the base.
  117. The 'output' file is perf record output for specific session.
  118. The 'control' and 'ack' files are perf control files.
  119. The 'up' number shows minutes daemon/session is running.
  120. Make sure control session is online:
  121. # perf daemon ping
  122. OK cycles
  123. OK sched
  124. Send USR2 signal to session 'cycles' to generate perf.data file:
  125. # perf daemon signal --session cycles
  126. signal 12 sent to session 'cycles [603452]'
  127. # tail -2 /opt/perfdata/session-cycles/output
  128. [ perf record: dump data: Woken up 1 times ]
  129. [ perf record: Dump perf.data.2020123017013149 ]
  130. Send USR2 signal to all sessions:
  131. # perf daemon signal
  132. signal 12 sent to session 'cycles [603452]'
  133. signal 12 sent to session 'sched [603453]'
  134. # tail -2 /opt/perfdata/session-cycles/output
  135. [ perf record: dump data: Woken up 1 times ]
  136. [ perf record: Dump perf.data.2020123017024689 ]
  137. # tail -2 /opt/perfdata/session-sched/output
  138. [ perf record: dump data: Woken up 1 times ]
  139. [ perf record: Dump perf.data.2020123017024713 ]
  140. Stop daemon:
  141. # perf daemon stop
  142. SEE ALSO
  143. --------
  144. linkperf:perf-record[1], linkperf:perf-config[1]