Kevin, On Thu, Jun 01, 2006 at 10:00:38AM -0500, Kevin Corry wrote: > > More specifically, we identify an event with a number (an "opaque descriptor" > as you call it below), which is usually an index into an arch-specific > internal array of events (although I suppose it doesn't strictly *have* to be > an index). An array of these event numbers is passed to the dispatch_events > routine, rather than the names of the events. For the unit-masks, we could do > basically the same thing, and have an array or list of mask numbers for each > event. Then we'd need APIs to get the mask number for a desired event number > and mask name. Perhaps something like: > > int pfm_find_event_mask(const char *mask_str, > unsigned int event_idx, > unsigned int *mask_idx); > int pfm_find_event_mask_byname(const char *mask_name, > unsigned int event_idx, > unsigned int *mask_idx); > int pfm_get_num_event_masks(unsigned int event_idx, > unsigned int *count); > int pfm_get_event_mask_name(unsigned int event_idx, > unsigned int mask_idx, > char *mask_name, > size_t maxlen); > int pfm_get_event_mask_description(unsigned int event_idx, > unsigned int mask_idx, > char **str); >
That looks reasonable. I think we can simplify the API some more for both event and unit mask. The find_*() and find_*_byname() are a bit redundant. The former searches by name or code (if first character is digit). We also have an explicit pfm_find_event*_bycode(). It seems we could smiplify by removing the pfm_find_event() function. Caller can do the checking for digit vs. alphabetical first caharacter and dispatch to the right function. Then we would augment the pfmlib_input_param_t.pfmlib_event_t structure with a new array to pass the unit mask descriptors. I suggest a size of 32 for that array. That should give us some slack. What do you think? -- -Stephane _______________________________________________ perfmon mailing list [email protected] http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
