Robert,

Patch applied.
Thanks.


On Tue, Mar 25, 2008 at 5:58 PM, Robert Richter <[EMAIL PROTECTED]> wrote:
> This patch removes the hardcoded number of counters of an AMD PMU and
>  instead uses a library function call to pfm_get_num_counters().
>
>  Signed-off-by: Robert Richter <[EMAIL PROTECTED]>
>  ---
>   pfmon/pfmon_amd64.c |   11 ++++++++---
>   1 files changed, 8 insertions(+), 3 deletions(-)
>
>  diff --git a/pfmon/pfmon_amd64.c b/pfmon/pfmon_amd64.c
>  index 02f0cb4..18db0ee 100644
>  --- a/pfmon/pfmon_amd64.c
>  +++ b/pfmon/pfmon_amd64.c
>  @@ -37,8 +37,9 @@ pfmon_amd64_setup_cnt_mask(pfmon_event_set_t *set)
>         char *cnt_mask_str;
>         char *p, *endptr = NULL;
>         unsigned long l;
>  -       unsigned int cnt=0;
>  +       unsigned int cnt = 0, cnt_mask_max = 0;
>         unsigned int i;
>  +       int ret;
>
>         args = set->mod_args;
>
>  @@ -54,6 +55,10 @@ pfmon_amd64_setup_cnt_mask(pfmon_event_set_t *set)
>                 return;
>         }
>
>  +       ret = pfm_get_num_counters(&cnt_mask_max);
>  +       if (ret != PFMLIB_SUCCESS)
>  +               fatal_error("Determining maximum number of counters "
>  +                           "failed with error code %d\n", ret);
>         while (cnt_mask_str) {
>
>                 if (cnt == options.max_counters || cnt == set->event_count)
>  @@ -64,7 +69,7 @@ pfmon_amd64_setup_cnt_mask(pfmon_event_set_t *set)
>                 if ( p ) *p = '\0';
>
>                 l = strtoul(cnt_mask_str, &endptr, 0);
>  -               if (*endptr || l < 0 || l >= PMU_AMD64_CNT_MASK_MAX)
>  +               if (*endptr || l < 0 || l >= cnt_mask_max)
>                                 goto invalid;
>
>                 if ( p ) *p++ = ',';
>  @@ -75,7 +80,7 @@ pfmon_amd64_setup_cnt_mask(pfmon_event_set_t *set)
>         }
>         return;
>   invalid:
>  -       fatal_error("event %d: counter mask must be in [0-%u)\n", cnt, 
> PMU_AMD64_CNT_MASK_MAX);
>  +       fatal_error("event %d: counter mask must be in [0-%u)\n", cnt, 
> cnt_mask_max);
>   too_many:
>         fatal_error("too many counter masks specified\n");
>   }
>  --
>  1.5.3.7
>
>
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
perfmon2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to