|
From: Frank C. <fra...@gm...> - 2011-06-03 15:00:46
|
Good morning, We are interested in selectively profiling certain periods of a program's execution. So, we looked in the callgrind manual and it says this: At the beginning of a program period you want to profile, set the counters to zero (add "CALLGRIND_ZERO_STATS;" into your source), and at the end, dump the profile to a file (add "CALLGRIND_DUMP_STATS;" into your source code). However, we found found that that callgrind 3.6.1 on Centos Linux Version 5.5 x86_32 takes 10 times longer to run even in those parts of the program that are not be selectively profiled by injecting CALLGRIND_ZERO_STATS and CALLGRIND_DUMP_STATS into source code. We were wondering if it possible to make callgrind run more faster when it not selectively profiling a certain period of a program's execution. Thank you. |
|
From: Josef W. <Jos...@gm...> - 2011-06-03 18:00:55
|
On Friday 03 June 2011, Frank Chang wrote: > At the beginning of a program period you want to profile, set the counters > to zero (add "CALLGRIND_ZERO_STATS;" > into your source), and at the end, dump the profile to a file (add > "CALLGRIND_DUMP_STATS;" into your source code). > > > However, we found found that that callgrind 3.6.1 on Centos Linux > Version 5.5 x86_32 takes 10 times longer to run even in those parts of > the program that are not be selectively profiled These macros do not influence whether simulation is done or not. So, of course, the simulation is running all the time. Switching off/on simulation can be done via the macros CALLGRIND_STOP_INSTRUMENTATION and CALLGRIND_START_INSTRUMENTATION There is an issue here: Switching instrumentation on will clean the cache state, so there will be a lot of misses directly after it, which would not happen in reality. So in principle, you should switch on instrumentation some time before zeroing counters for start of measurement. However, the error usually is small even if you directly start measurement when starting full instrumentation. Josef |
|
From: Frank C. <fra...@gm...> - 2011-06-04 15:42:58
|
Josef Weidendorfer, Thank you for your help with CALLGRIND_START_INSTRUMENTATION and CALLGRIND_STOP_INSTRUMENTATION. We are starting to use it now.Thank you again. On Fri, Jun 3, 2011 at 11:00 AM, Josef Weidendorfer <Jos...@gm...> wrote: > On Friday 03 June 2011, Frank Chang wrote: >> At the beginning of a program period you want to profile, set the counters >> to zero (add "CALLGRIND_ZERO_STATS;" >> into your source), and at the end, dump the profile to a file (add >> "CALLGRIND_DUMP_STATS;" into your source code). >> >> >> However, we found found that that callgrind 3.6.1 on Centos Linux >> Version 5.5 x86_32 takes 10 times longer to run even in those parts of >> the program that are not be selectively profiled > > These macros do not influence whether simulation is done or not. > So, of course, the simulation is running all the time. > > Switching off/on simulation can be done via the macros > CALLGRIND_STOP_INSTRUMENTATION > and > CALLGRIND_START_INSTRUMENTATION > > There is an issue here: Switching instrumentation on will clean > the cache state, so there will be a lot of misses directly after > it, which would not happen in reality. > So in principle, you should switch on instrumentation some time > before zeroing counters for start of measurement. However, the > error usually is small even if you directly start measurement > when starting full instrumentation. > > Josef > |