lkml.org 
[lkml]   [2011]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/3] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
    Date
    From: David Ahern <daahern@cisco.com>

    Resend of patch sent back in January 2011 in light of recent confusion around
    unsupported events for a given platform.

    Improve sys_perf_event_open ENOENT return handling in top and record, just
    like 5a3446b does for stat.

    Retry of Arnaldo's patch using ui_warning instead of die which allows the
    fallback from hardware cycles to software clock.

    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-kernel@vger.kernel.org
    LKML-Reference: <1301080271-20945-1-git-send-email-daahern@cisco.com>
    Signed-off-by: David Ahern <daahern@cisco.com>
    [ committer note: Some adjustments to make it apply to newer codebase ]
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    ---
    tools/perf/builtin-record.c | 10 +++++++++-
    tools/perf/builtin-top.c | 6 ++++++
    2 files changed, 15 insertions(+), 1 deletions(-)

    diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
    index 623695e..db6adec 100644
    --- a/tools/perf/builtin-record.c
    +++ b/tools/perf/builtin-record.c
    @@ -301,11 +301,19 @@ try_again:
    && attr->config == PERF_COUNT_HW_CPU_CYCLES) {

    if (verbose)
    - warning(" ... trying to fall back to cpu-clock-ticks\n");
    + ui__warning("The cycles event is not supported, "
    + "trying to fall back to cpu-clock-ticks\n");
    attr->type = PERF_TYPE_SOFTWARE;
    attr->config = PERF_COUNT_SW_CPU_CLOCK;
    goto try_again;
    }
    +
    + if (err == ENOENT) {
    + ui__warning("The %s event is not supported.\n",
    + event_name(pos));
    + exit(EXIT_FAILURE);
    + }
    +
    printf("\n");
    error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n",
    err, strerror(err));
    diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
    index 935fc4f..fc1273e 100644
    --- a/tools/perf/builtin-top.c
    +++ b/tools/perf/builtin-top.c
    @@ -870,6 +870,12 @@ try_again:
    goto try_again;
    }

    + if (err == ENOENT) {
    + ui__warning("The %s event is not supported.\n",
    + event_name(counter));
    + goto out_err;
    + }
    +
    ui__warning("The sys_perf_event_open() syscall "
    "returned with %d (%s). /bin/dmesg "
    "may provide additional information.\n"
    --
    1.6.2.5


    \
     
     \ /
      Last update: 2011-03-30 04:37    [W:0.022 / U:0.464 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site