Corey,

I had a second thought on all of this while you are enjoying your long
week-end ;->


I think we could use your proposed structure and call as a substitute
for most of the attribute entry points such as:
   pfm_get_event_attr_name()
   pfm_get_event_attr_desc()
   pfm_get_event_attr_code()
   pfm_get_event_attr_type()

struct pfm_attr_info_t {
   char *name;
   char *desc;
   pfm_attr_t type;
   struct {
        int is_default:1; /* boolean */
        int mandatory:1; /* 1 = mandatory, 0 = optional */
        int reserved:30;
   }
   int idx; <<<
   uint64_t code; <<<
   int size; <<< /* for future extension */
   union {
       uint64_t dfl_64; <<<
       const char *dfl_str;
       int dfl_bool;
       int dfl_int;
   };
};

Instead of:
   pfm_get_event_attr_info(int idx, int attr_idx, pfm_attr_info_t
*attr_infos, int *n_attrs);
Do:
   pfm_get_event_attr_info(int idx, pfm_attr_info_t *attr_infos);

I think we could also do something similar with the event entry points.

struct pfm_event_info_t {
   char *name;
   char *desc;
   int idx;
   int n_attrs;   /* number of attributes */
   uint64_t code; /* event code */
   int pmu; /* which pmu */
};
pfm_get_event_info(int idx, struct pfm_event_info_t *info);

To replace:
   pfm_get_event_name();
   pfm_get_event_desc();
   pfm_get_event_nattrs();
   pfm_get_event_code();
   pfm_get_event_pmu();

We would still have pfm_get_event_encoding() and all the iterators.


To figure out the default for an event, you would do:

idx = pfm_find_event("UOPS_ISSUED");
for_each_event_attr(i, idx) {
     pfm_get_event_attr_info(idx, i, &attr_info);
     if (attr_info->is_default) {
         printf("default: %s\n", attr_info->name);
     }
}

There are still some issues, I think with certain defaults. Take
my cache MESI example. The M, E, S, I, attributes can be set
individually, any combination is valid. But there needs to be at
least one of them set. Given your proposed attr_info structure,
it is not clear how this could be expressed. None of the individual
MESI bit are mandatory. What is mandatory is that one of them
must be set. And they are considered unit masks, not modifiers,
though we could make them that way but it is not clear that would
help.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to