Search code examples
cperformanceloader

how to computer performace of a pro c file


I have come across .prof file (at least the extension tell me so) which I think was used to analyze the performance of loaders which are written in pro c language.

I am writing a new similar loader and I want to analyze the performance of my program.

I have pasted the first few lines of .prof file here :

%Time Seconds Cumsecs  #Calls   msec/call  Name
  90.8  235.13  235.13       0      0.0000  strlen
   3.2    8.17  243.30       0      0.0000  _read
   1.3    3.33  246.63  897580      0.0037  Search
   1.0    2.56  249.19       0      0.0000  _lseek
   0.6    1.43  250.62       0      0.0000  _kill
   0.5    1.39  252.01       0      0.0000  _write
   0.3    0.83  252.84  864734      0.0010  _doprnt
   0.3    0.75  253.59       0      0.0000  _mcount0

I am interested in two points:

  • which kind of file is this
  • how can i generate such a file in unix environment (command?)

Solution

  • That looks like an (outdated?) gprof flat profile.

    These are generated with gcc by adding -pg to the command line options, and running the program.

    The profile tells us that the tested code spends a very long time running strlen().