lkml.org 
[lkml]   [2013]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v0 29/71] perf pmu: Let pmu's with no events show up on perf list
    Date
    From: Adrian Hunter <adrian.hunter@intel.com>

    perf list only lists PMUs with events. Add a
    flag to cause a PMU to be also listed separately.

    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    ---
    tools/perf/util/pmu.c | 13 +++++++++++--
    tools/perf/util/pmu.h | 1 +
    2 files changed, 12 insertions(+), 2 deletions(-)

    diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
    index a742eeb..c6c240f 100644
    --- a/tools/perf/util/pmu.c
    +++ b/tools/perf/util/pmu.c
    @@ -733,15 +733,18 @@ void print_pmu_events(const char *event_glob, bool name_only)

    pmu = NULL;
    len = 0;
    - while ((pmu = perf_pmu__scan(pmu)) != NULL)
    + while ((pmu = perf_pmu__scan(pmu)) != NULL) {
    list_for_each_entry(alias, &pmu->aliases, list)
    len++;
    + if (pmu->selectable)
    + len++;
    + }
    aliases = malloc(sizeof(char *) * len);
    if (!aliases)
    return;
    pmu = NULL;
    j = 0;
    - while ((pmu = perf_pmu__scan(pmu)) != NULL)
    + while ((pmu = perf_pmu__scan(pmu)) != NULL) {
    list_for_each_entry(alias, &pmu->aliases, list) {
    char *name = format_alias(buf, sizeof(buf), pmu, alias);
    bool is_cpu = !strcmp(pmu->name, "cpu");
    @@ -758,6 +761,12 @@ void print_pmu_events(const char *event_glob, bool name_only)
    aliases[j] = strdup(aliases[j]);
    j++;
    }
    + if (pmu->selectable) {
    + scnprintf(buf, sizeof(buf), "%s//", pmu->name);
    + aliases[j] = strdup(buf);
    + j++;
    + }
    + }
    len = j;
    qsort(aliases, len, sizeof(char *), cmp_string);
    for (j = 0; j < len; j++) {
    diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
    index 437fdb2..d5266d1 100644
    --- a/tools/perf/util/pmu.h
    +++ b/tools/perf/util/pmu.h
    @@ -18,6 +18,7 @@ struct perf_event_attr;
    struct perf_pmu {
    char *name;
    __u32 type;
    + bool selectable;
    struct perf_event_attr *default_config;
    struct cpu_map *cpus;
    struct list_head format;
    --
    1.8.5.1


    \
     
     \ /
      Last update: 2013-12-11 17:41    [W:4.046 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site