Re: [perfmon2] pfm_start/pfm_stop needed for thread-based self-monitoring?
Status: Beta
Brought to you by:
seranian
From: stephane e. <er...@go...> - 2008-12-22 11:20:52
|
Hello, On Mon, Dec 22, 2008 at 5:50 AM, Andrej van der Zee <and...@gm...> wrote: > Hi, > > I am using perfmon2 for thread-based self-monitoring. The thread > executes many requests and I want to monitor each request separately. > To make it little intrusive as possible, I am trying to minimize code > for re-initialization of the PMU for each request as much as possible. > For each request, I execute the following code now: > You don't really need to reset for each request. You can just read at the beginning and end of each request and compute delta. As for start/stop, it all depends on the level of granularity. For self-monitoring, and if all PMD fit within one syscall, I think there is little reason for stopping. The read syscall will readout the hardware values fairly closely from each others. > for (i=0; i < thd->mbrace_data.output_param.pfp_pmd_count; i++) { > thd->mbrace_data.pmd[i].reg_value = 0; > } > > if (pfm_write_pmds(thd->mbrace_data.context_fd, thd->mbrace_data.pmd, > thd->mbrace_data.output_param.pfp_pmd_count)) { > general_log_print(thd, COM_MBRACE, "mBrace: pfm_write_pmds error > errno %d", errno); > return; > } > > if (pfm_start(thd->mbrace_data.context_fd, NULL)) { > general_log_print(thd, COM_MBRACE, "mBrace: pfm_start error errno > %d", errno); > return; > } > > > But I was wondering, for thread-based self-monitoring, do I really > need to call pfm_start and pfm_stop for every request? Or can I > read/write the PMU without stopping pfm? > > Thank you, > Andrej > > ------------------------------------------------------------------------------ > _______________________________________________ > perfmon2-devel mailing list > per...@li... > https://lists.sourceforge.net/lists/listinfo/perfmon2-devel > |