Re: [perfmon2] Counting for child threads
Status: Beta
Brought to you by:
seranian
|
From: Stephane E. <er...@go...> - 2015-04-27 21:11:08
|
Hi, On Fri, Apr 24, 2015 at 9:33 PM, Yunqi Zhang <zha...@gm...> wrote: > Hi all, > > I'm trying to use libpfm to collect performance counter data for some > multi-threaded applications. I would like to aggregate the data for all the > child threads under the same process. I found that the "inherit" flag does > not work for existing children threads as suggested by perf_event_open > <http://man7.org/linux/man-pages/man2/perf_event_open.2.html>. > > *inherit* > The *inherit* bit specifies that this counter should count > events of child tasks as well as the task specified. This > applies only to new children, not to any existing children at > the time the counter is created (nor to any new children of > existing children). > > However, it seems to me that the tool perf stat > <https://perf.wiki.kernel.org/index.php/Main_Page> that comes with Linux > kernel works just fine in this case, which aggregates the counter data for > all the child threads even when they already exist. > > I was wondering how I can use libpfm to achieve the same purpose, or how perf > stat implements this functionality. > > libpfm4 does not make the perf_event_open() syscall for you. This is still under the control of your app. Therefore, you can set the perf_event_attr->inherit flag in the struct after you've called libpfm4 and before you call perf_event_open(). You can look at perf_examples/task.c for an example. > Thank you! > > Yunqi > > > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > perfmon2-devel mailing list > per...@li... > https://lists.sourceforge.net/lists/listinfo/perfmon2-devel > > |