Profiling

Sometimes you will have a problem that your OpenMP program does not speed up as you expect. In such case, profiling the program may help you to analyze and solve the problem.

To enable profiling of the execution, turn on profiling by setting OMPC_LOG:

       setenv OMPC_LOG
And run your OpenMP program as usual. For example:
       a.out
When run your program, the log file is created with the name of your program and ".log" extension. For example, if the name of the program is "a.out", the log file "a.out.log" is created. In the log file, several timings of parallel region, barrier and scheduling events are included. The kinds of the events in the log file are defined in "lib/libtlog/tlog.h".

To see the log file, use "tlogview" command:

       tlogview a.out.log
tlogview is a profile visualization tool, which allow you to check several states and events of OpenMP during the execution in the window. By dragging the region in the window by mouse, you can zoom up the selected region to see the status more preciously. For more information and usage of tlogview, check tlogview .

To disable profiling, unset OMPC_LOG environment variable:

       unsetenv OMPC_LOG

Note that when profiling is on, the execution is getting slow down due to the overhead for getting the timing for each event. As default, the timer routine uses the "gettimeofday" system call which give wall clock time. The resolution of timing depends on the timer routine. You may replace the timer routine with platform-specific routine in "lib/libtlog/tlog-time.c".