This is for supporting uncore events.

I tested this diff with Lin Ming's uncore patch against the kernel
http://thread.gmane.org/gmane.linux.kernel/1071064

diff --git a/include/perfmon/perf_event.h b/include/perfmon/perf_event.h
index defc88e..de5691e 100644
--- a/include/perfmon/perf_event.h
+++ b/include/perfmon/perf_event.h
@@ -29,6 +29,7 @@ enum perf_type_id {
        PERF_TYPE_HW_CACHE              = 3,
        PERF_TYPE_RAW                   = 4,
        PERF_TYPE_BREAKPOINT            = 5,
+       PERF_TYPE_UNCORE                = 6,
        PERF_TYPE_MAX,                  /* non-ABI */
 };
 
diff --git a/lib/pfmlib_intel_nhm_unc.c b/lib/pfmlib_intel_nhm_unc.c
index 7fcdf28..1221190 100644
--- a/lib/pfmlib_intel_nhm_unc.c
+++ b/lib/pfmlib_intel_nhm_unc.c
@@ -100,17 +100,23 @@ pfm_wsm_unc_detect(void *this)
        return PFM_SUCCESS;
 }
 
+#ifdef __linux__
+#include "pfmlib_perf_event_priv.h"
 static int
 intel_nhm_unc_perf_encode(void *this, pfmlib_event_desc_t *e)
 {
-#if 0
        struct perf_event_attr *attr = e->os_data;
-       /* not yet supported by perf_event */
-       attr->type = PERF_TYPE_RAW;
+       attr->type = PERF_TYPE_UNCORE;
        attr->config = e->codes[0];
-#endif
-       return PFM_ERR_NOTSUPP;
+       /* Can't exclude anything */
+       attr->exclude_user = 0;
+       attr->exclude_kernel = 0;
+       attr->exclude_hv = 0;
+       attr->exclude_idle = 0;
+
+       return PFM_SUCCESS;
 }
+#endif
 
 static int
 intel_nhm_unc_os_encode(void *this, pfmlib_event_desc_t *e)
diff --git a/lib/pfmlib_perf_event.c b/lib/pfmlib_perf_event.c
index 879efb6..1c7a90b 100644
--- a/lib/pfmlib_perf_event.c
+++ b/lib/pfmlib_perf_event.c
@@ -83,6 +83,7 @@ pfmlib_perf_event_encode(void *this, const char *str, int 
dfl_plm, void *data)
 
        e.osid = os->id;
        e.os_data = attr;
+       e.dfl_plm = dfl_plm;
 
        ret = pfmlib_parse_event(str, &e);
        if (ret != PFM_SUCCESS)

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to