On Tue, Feb 15, 2011 at 9:20 PM, Arun Sharma <asha...@fb.com> wrote:
>
> * Remove unimplemented functions from headers (so swig doesn't generate code 
> for them)
> * Rename the output argument so swig can handle it properly.
> * Pass the new pfm_os_t arg properly
> ---
>  include/perfmon/pfmlib.h |    3 +--
>  lib/pfmlib_common.c      |   44 --------------------------------------------

Why do you need to remove #if 0 code?



>  python/src/pmu.py        |   10 +++++++---
>  3 files changed, 8 insertions(+), 49 deletions(-)
>
> diff --git a/include/perfmon/pfmlib.h b/include/perfmon/pfmlib.h
> index 61ead39..97124df 100644
> --- a/include/perfmon/pfmlib.h
> +++ b/include/perfmon/pfmlib.h
> @@ -290,10 +290,9 @@ extern pfm_err_t pfm_get_pmu_info(pfm_pmu_t pmu, 
> pfm_pmu_info_t *output);
>  /*
>  * event API
>  */
> -extern int pfm_get_event_first(void);
>  extern int pfm_get_event_next(int idx);
>  extern int pfm_find_event(const char *str);
> -extern pfm_err_t pfm_get_event_info(int idx, pfm_os_t os, pfm_event_info_t 
> *info);
> +extern pfm_err_t pfm_get_event_info(int idx, pfm_os_t os, pfm_event_info_t 
> *output);
>
>  /*
>  * event encoding API
> diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
> index 6aa85aa..2088891 100644
> --- a/lib/pfmlib_common.c
> +++ b/lib/pfmlib_common.c
> @@ -960,26 +960,6 @@ error:
>        return ret;
>  }
>
> -#if 0
> -/*
> - * total number of events
> - */
> -int
> -pfm_get_nevents(void)
> -{
> -       pfmlib_pmu_t *pmu;
> -       int i, total = 0;
> -
> -       pfmlib_for_each_pmu(i) {
> -               pmu = pfmlib_pmus[i];
> -               if (!pfmlib_pmu_initialized(pmu))
> -                       continue;
> -               total += pmu->pme_count;
> -       }
> -       return total;
> -}
> -#endif
> -
>  /* sorry, only English supported at this point! */
>  static const char *pfmlib_err_list[]=
>  {
> @@ -1029,30 +1009,6 @@ pfm_get_event_next(int idx)
>        return pidx == -1 ? -1 : pfmlib_pidx2idx(pmu, pidx);
>  }
>
> -#if 0
> -int
> -pfm_get_event_first(void)
> -{
> -       pfmlib_pmu_t *pmu;
> -       int i, pidx;
> -
> -       /* scan all compiled in PMU models */
> -       pfmlib_for_each_pmu(i) {
> -               pmu = pfmlib_pmus[i];
> -               /*
> -                * check if pmu validated
> -                */
> -               if (!pfmlib_pmu_initialized(pmu))
> -                       continue;
> -
> -               pidx = pmu->get_event_first(pmu);
> -               if (pidx != -1)
> -                       return pfmlib_pidx2idx(pmu, pidx);
> -       }
> -       return -1;
> -}
> -#endif
> -
>  int
>  pfm_get_os_event_encoding(const char *str, int dfl_plm, pfm_os_t uos, void 
> *args)
>  {
> diff --git a/python/src/pmu.py b/python/src/pmu.py
> index 9e8c01c..e90b72a 100644
> --- a/python/src/pmu.py
> +++ b/python/src/pmu.py
> @@ -34,6 +34,9 @@ def public_members(self):
>     return s
>
>  class System:
> +  # Use the os that gives us everything
> +  os = PFM_OS_PERF_EVENT_EXT
> +
>   def __init__(self):
>     self.ncpus = os.sysconf('SC_NPROCESSORS_ONLN')
>     self.pmus = []
> @@ -59,7 +62,8 @@ class Event:
>   def __parse_attrs(self):
>     info = self.info
>     for index in range(0, info.nattrs):
> -      self.__attrs.append(pfm_get_event_attr_info(info.idx, index)[1])
> +      self.__attrs.append(pfm_get_event_attr_info(info.idx, index,
> +                                                  System.os)[1])
>
>   def attrs(self):
>     if not self.__attrs:
> @@ -72,9 +76,9 @@ class PMU:
>     self.__events = []
>
>   def __parse_events(self):
> -    index = pfm_get_event_first()
> +    index = self.info.first_event
>     while index != -1:
> -      self.__events.append(Event(pfm_get_event_info(index)[1]))
> +      self.__events.append(Event(pfm_get_event_info(index, System.os)[1]))
>       index = pfm_get_event_next(index)
>
>   def events(self):
> --
> 1.7.4
>
>

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to