PERF_EVENT_IOC_RESET doesn't seem to work properly when the inherit bit is set (which is set when the benchmark uses a child process). To get around this, we now close and re-open perf fds for each sample.
Closes #17
Note: This seems to be the better approach. I tried reading the fds before each sample and then subtracting the initial values from the final values, but I was running into intermittent cases where the end - start would end up as zero. With the approach in this PR, I haven't run into that (yet?).
PERF_EVENT_IOC_RESET
doesn't seem to work properly when theinherit
bit is set (which is set when the benchmark uses a child process). To get around this, we now close and re-open perf fds for each sample.Closes #17
Note: This seems to be the better approach. I tried reading the fds before each sample and then subtracting the initial values from the final values, but I was running into intermittent cases where the
end - start
would end up as zero. With the approach in this PR, I haven't run into that (yet?).