intel/pinball2elf

Sometimes the hardware counter output of an elfie will appear in FD_{x}

haiyang1992 opened this issue · 2 comments

I am trying to generate elfies from SPEC CPU2017 pinpoints that I collected. After generating the sysstate directory, I run pinball2elf.perf.sh. Yet sometimes the hardware counter statistics don't show up in perf.txt but in the FD_{x} file generated under the sysstate directory.

Example:
My pinball is x264_1.ref_2997922_t0r7_warmup300001500_prolog0_region100000040_epilog0_007_0-00567.0

The output of perf.txt:

ROI start: TSC 737871404481068

When I looked at the FD_4 file in the sysstate directory, part of the statistics show up in the middle of a normal x264 file output:
Screen Shot 2021-05-24 at 4 37 47 PM

Hi:
This seems to an undesirable interaction between the performance monitoring code added by pinball2elf and the application. Specifically, the elfie_on_start() routine [ see perf_callbacks.c created for your specific application in the work directory] opens output files for each thread stores it in "int out_fd[FILECOUNT];". It is possible that the perf file gets an fd which was actually used by the application (as indicated by the presence of FD_x file for the same fd(==x)). The routine preopen_files() will open FD_x files and make sure they get the expected fd==x(using dup2()). However, in the process, it will change where performance output will go.
Looks like the FD_x file in your case was used as an output file in the original application therefore its presence will not be required for correct execution of the ELFie. If that is indeed the case, consider manually removing the offending FD_x from the SYSSTATE directory. This should direct the performance output to the right file. Although now that file will also get output from the application which originally went to the deleted FD_x.
Let me know if you think of a cleaner solution/work-around.

Thank you for your quick response. I think removing the FD_x should be enough for now, just some extra parsing needed.