Measuring time of each program segment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • urkel
    New Member
    • Jul 2007
    • 5

    Measuring time of each program segment

    Dear all,
    I write a code in C and run it on Linux using icc compiler. However, there are too many iterations in the program and it takes so much time to complete just one run of the program (more than 3 days). Is there any special library function, command or subroutine that can be used to monitor the computing time of the program execution, that is to check which particular part of the program (which iteration) that takes the largest amount of computing time so that I know which part may need some modification?

    Thanks in advance.

    urkel
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    What you want to do has a name: profiling. You should Google search on profiling, i.e. profiling Linux, profiling code Linux, and all sorts of terms to get lots of reading material. There are programs out there to help you out in profiling code. Since you are using the Intel compiler, maybe you can get a hold of an Intel profiler (like VTune)?

    Also, if your program takes unusually long, a bit of intuition may tell you which part of the code to look at first, because you wrote a sloppy algorithm or the like.

    Comment

    Working...