Commit aae5edb
authored
Implement perf stat --control for cgi (phpGH-22537)
perf stat --control allows the profiled process to enable and disable counters
at runtime. This allows us to skip profiling startup and shutdown for more
accurate results. The same already exists for valgrind.
$ perf stat -D -1 --control fifo:/tmp/perfctl,/tmp/perfack
-D -1 starts perf stat with counters disabled. --control makes perf stat connect
to the /tmp/perfctl and /tmp/perfack fifo files. These need to exist when
starting perf, so create them using mkfifo /tmp/perf{ctl,ack}. The ctl fifo is
written to by cgi to enable/disable counters, whereas the ack fifo is written to
by perf stat to acknowledge counters have been installed.
Additionally, you'll need to set the set the PERF_STAT_CTL_FIFO and
PERF_STAT_ACK_FIFO env variables for cgi to find the fifo files.1 parent 9a14b9b commit aae5edb
2 files changed
Lines changed: 146 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
1733 | 1735 | | |
1734 | 1736 | | |
1735 | 1737 | | |
| 1738 | + | |
1736 | 1739 | | |
1737 | 1740 | | |
1738 | 1741 | | |
| |||
2441 | 2444 | | |
2442 | 2445 | | |
2443 | 2446 | | |
2444 | | - | |
2445 | 2447 | | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
2446 | 2451 | | |
2447 | 2452 | | |
2448 | 2453 | | |
2449 | 2454 | | |
2450 | | - | |
2451 | 2455 | | |
| 2456 | + | |
2452 | 2457 | | |
2453 | 2458 | | |
2454 | 2459 | | |
| |||
2568 | 2573 | | |
2569 | 2574 | | |
2570 | 2575 | | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
2571 | 2580 | | |
2572 | 2581 | | |
2573 | 2582 | | |
| |||
0 commit comments