linux perf tool impact on application execution time

  Kiến thức lập trình

We have a simple tool runtime_probe that performs some hardware checks.

I ran the runtime_probe 30 times on chromeos and in the background i also ran the perf command:

perf record -F 8000 -m 32M

I noticed something interesting. For the first few runs, execution times of runtime_probe was normal. However after the first perf.data write to the disk (after the buffer of 32MB was full), runtime_probe started taking more time.

Please check the screenshot:

In the screenshot the green line is execution time of runtime_probe with perf and the blue is without perf. You can see that initially, even with perf the runtime_probe was taking close to the normal time to execute. But after the first buffer flush by perf, same command is taking more time to execute.

Any idea as to why perf is behaving this way? Shouldn’t the perf buffer be emptied after the write and there should be little impact on execution time? What happens after the first buffer flush that causes increase in execution time?

LEAVE A COMMENT