[perfmon] Re: perfmon2 TODO list
William Cohen
wcohen@redhat.com
Thu Apr 13 18:59:00 GMT 2006
Kevin Corry wrote:
> On Thu April 13 2006 11:41 am, Frank Ch. Eigler wrote:
>
>>I am a developer on the systemtap project, which Will Cohen has
>>referred you to earlier in the discussion. I thought I would jump in
>>just to add/refresh focus on one important perfmon requirement for
>>systemtap: a kernel-side API.
>
>
> As I mentioned in my previous email, it seems like we ought to be able to do
> just a little reorg, and provide an in-kernel interface that looks pretty
> much identical to the system-call interface, and actually wrapper the
> system-calls around it. Perhaps I'll give this a shot today or tomorrow with
> a couple of the system-calls and send in a patch and see what everyone
> thinks.
>
The list of systemcalls in perfmon.h is:
extern int pfm_create_context(pfarg_ctx_t *ctx, void *smpl_arg, size_t
smpl_size);
extern int pfm_write_pmcs(int fd, pfarg_pmc_t *pmcs, int count);
extern int pfm_write_pmds(int fd, pfarg_pmd_t *pmds, int count);
extern int pfm_read_pmds(int fd, pfarg_pmd_t *pmds, int count);
extern int pfm_load_context(int fd, pfarg_load_t *load);
extern int pfm_start(int fd, pfarg_start_t *start);
extern int pfm_stop(int fd);
extern int pfm_restart(int fd);
extern int pfm_create_evtsets(int fd, pfarg_setdesc_t *setd, int count);
extern int pfm_getinfo_evtsets(int fd, pfarg_setinfo_t *info, int count);
extern int pfm_delete_evtsets(int fd, pfarg_setdesc_t *setd, int count);
extern int pfm_unload_context(int fd);
SystemTap probably wouldn't use the evtset calls.
Thoughts on the kernel ABI:
Use "struct pfm_context *ctx" rather than "int fd".
For pfm_create_context pass in addition argument to store a pointer for
the allocated context because.
Have a function to explicitly free the perfmon context, can't tell when
the file descriptor is no longer used by a process.
One of the concerns with systemtap is memory allocations.
Instrumentation probes could be placed most anywhere. Expect that the
create_context would allocate memory and would be limited to when the
instrumentation is load and would be used in any probes. However, the
equivalent pfm_read_pmds would be used nearly any where.
Would there be an equivalent "custom buffer" mechanism to the kernel?
This seems to be the mechanism to implement the call-back mechanism that
Frank mentioned. In perfmon2 that expects the data to be read out
through a file into user space.
-Will
More information about the Systemtap
mailing list