On Thursday 18 November 2010, edA-qa mort-ora-y wrote:
> I am using CALLGRIND_START_INSTRUMENTATION and STOP at some key
> locations in my code. In one location it works as expected, collecting
> data only for the part of the code I'm interested in. In the other
> location it collects data for other threads at the same time, not just
> the part I'm interested in.
> 
> Is START/STOP thread sensitive, or is it program wide? That is, can I
> actually record data only for a single thread?

Switching the instrumentation mode is a global option, ie. program wide.
There is no other way, as the instrumentation is added to the code, and
every thread will execute it.

With instrumentation on, you still can decide not to aggregate events in given
threads by switching the collection state on/off with CALLGRIND_TOGGLE_COLLECT.
The collection state is thread specific.

The big difference between instrumentation and collection state is the 
following:
if instrumentation is switched off, the state of the cache is not updated. Thus,
after switching instrumentation state on, callgrind starts with a freshly 
initialized
cache, ie. you will get a lot of cold misses. This would not happen in reality, 
as
of course, a cache is always active. Either these wrong cold misses do not 
matter for
you, or you should switch on instrumentation before starting to collect the 
events,
to make sure that the cache is "warmed up".

Thus, with instrumentation on, and collection off, the cache state will still 
be updated
and valid, and you just do count events (collection on) or not (collection off).
This is probably the thing you want.

The option to switch instrumentation mode is only useful for "fast forwarding" 
over
uninteresting, large parts of the code, where you want all threads to progress 
fast.

Best,
Josef





> 
> 
> I already know about the separate-threads option, but that is a bit
> clumsier to analyze later. Plus the code I'm interested in does actually
> run in multiple threads, it'd be nice to have them combined.
> 



------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to