Thanks. I will try out both options. On Tue, Mar 26, 2013 at 6:02 PM, Vince Weaver <vi...@deater.net> wrote: > On Tue, 26 Mar 2013, kernel kernel wrote: > >> Is it possible to use perf to record the performance counters of >> specific lines of code instead of the entire program? > > If you want exact counts (i.e., these three lines of code had exactly > 20 branch misses) you'll need to instrument your code using a library like > PAPI, or else insert raw perf_event calls yourself before and after > the lines of interest (see the example at the end of the perf_event_open > manpage). > > Doing self-monitoring like this introduces a certain amount of overhead > into your program and measurements. > > Vince
-- Ken O'Brien PhD Researcher Simulation Science and Extreme Events Cluster, 3B1, UCD CASL, 8 Belfield Business Park, Dublin 4, Ireland. -- To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html