Perf is a tool used to profile any code in Linux. By following the steps below, you will manage to profile your Fortran binary. It will only provide a simple overview of each function and how much time is spent there. However, this can be your first steps towards improving the execution time of your program.

The current example only runs in a single core, so no threads nor any other type of parallelism is involved.

1- Compile your binary as usual

2- Run the application as:

perf record -g <your binary>

Among the outputs, a new file named perf.data will appear

3- To visualize the results type:

perf report

A terminal user interface will show up:

perf report screenshot

It will provide a first overview of your application.

  • ‘Children’: % total time of the function involved during runtime
  • ‘Self’: % of time of the current function running (the important column)
  • ‘Command’: ?
  • ‘Shared Object’: ?
  • ‘Symbol’: name of the function. Be aware it could also include system calls such as malloc, _int_free, …

Leave a Reply

Your email address will not be published. Required fields are marked *