Mostly assists to swig to help understand the input/output
args and their types.

Signed-off-by: Arun Sharma <a...@sharma-home.net>
---
 include/perfmon/perf_event.h        |    7 ++++---
 include/perfmon/pfmlib_perf_event.h |    2 +-
 python/src/perfmon_int.i            |   21 ++++++---------------
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/include/perfmon/perf_event.h b/include/perfmon/perf_event.h
index f620bae..8d4a396 100644
--- a/include/perfmon/perf_event.h
+++ b/include/perfmon/perf_event.h
@@ -27,6 +27,7 @@
 #include <sys/syscall.h>       /* for syscall stub macros */
 #include <sys/ioctl.h>         /* for _IO */
 #include <sys/prctl.h>         /* for prctl() comamnds */
+#include <perfmon/pfmlib.h>    /* for os_err_t */
 
 #ifdef __cplusplus
 extern "C" {
@@ -158,7 +159,7 @@ enum perf_event_read_format {
 /*
  * perf_event_attr struct passed to perf_event_open()
  */
-struct perf_event_attr {
+typedef struct perf_event_attr {
        uint32_t        type;
        uint32_t        size;
        uint64_t        config;
@@ -199,7 +200,7 @@ struct perf_event_attr {
        uint32_t        bp_type;
        uint64_t        bp_addr;
        uint64_t        bp_len;
-};
+} perf_event_attr_t;
 
 /*
  * perf_events ioctl commands, use with event fd
@@ -321,7 +322,7 @@ enum perf_callchain_context {
 /*
  * perf_event_open() syscall stub
  */
-static inline int
+static inline os_err_t 
 perf_event_open(
        struct perf_event_attr          *hw_event_uptr,
        pid_t                           pid,
diff --git a/include/perfmon/pfmlib_perf_event.h 
b/include/perfmon/pfmlib_perf_event.h
index e610f51..91de819 100644
--- a/include/perfmon/pfmlib_perf_event.h
+++ b/include/perfmon/pfmlib_perf_event.h
@@ -53,7 +53,7 @@ typedef struct {
  */
 extern pfm_err_t pfm_get_perf_event_encoding(const char *str,
                                             int dfl_plm,
-                                            struct perf_event_attr *attr,
+                                            perf_event_attr_t *output,
                                             char **fstr,
                                             int *idx);
 
diff --git a/python/src/perfmon_int.i b/python/src/perfmon_int.i
index 59b1d64..db6f4c5 100644
--- a/python/src/perfmon_int.i
+++ b/python/src/perfmon_int.i
@@ -88,27 +88,18 @@ ptr_argout(pfm_pmu_info_t);
 ptr_argout(pfm_event_info_t);
 ptr_argout(pfm_event_attr_info_t);
 
+%typedef int pid_t;
+
 /* Kernel interface */
 %include <perfmon/perf_event.h>
+ptr_argout(perf_event_attr_t);
+
 /* Library interface */
 /* We never set the const char * members. So no memory leak */
 #pragma SWIG nowarn=451
 %include <perfmon/pfmlib.h>
-
-%typedef int pid_t;
-
-extern os_err_t
-perf_event_open(
-    struct perf_event_attr   *hw_event_uptr,
-    pid_t                    pid,
-    int                      cpu,
-    int                      group_fd,
-    unsigned long            flags);
-
-ptr_argout(perf_event_attr);
-extern pfm_err_t
-pfm_get_perf_event_encoding(const char *str, int dfl_plm,
-                            struct perf_event_attr *output, char **fstr, int 
*idx);
+/* OS specific library interface */
+%include <perfmon/pfmlib_perf_event.h>
 
 %init %{
   libpfm_err = PyErr_NewException("perfmon.libpfmError", NULL, NULL);
-- 
1.7.0.4


------------------------------------------------------------------------------
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