[php-src] PR #22537: Implement perf stat --control for cgi
| From: | iluuu1994 | Date: | Wed, 01 Jul 2026 14:30:54 +0000 |
| Subject: | [php-src] PR #22537: Implement perf stat --control for cgi | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36760@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22537
Author: iluuu1994
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. --controlz 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 acknolwedge 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.