lkml.org 
[lkml]   [2012]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 13/13] perf stat: Use perf_evlist__create_maps
    Date
    Use same function with perf record and top to share the code
    checks combinations of different switches.

    Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
    ---
    tools/perf/builtin-stat.c | 22 ++++++++--------------
    1 file changed, 8 insertions(+), 14 deletions(-)

    diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
    index d9ff24637eeb..e720ba7b801e 100644
    --- a/tools/perf/builtin-stat.c
    +++ b/tools/perf/builtin-stat.c
    @@ -175,7 +175,9 @@ static struct perf_event_attr very_very_detailed_attrs[] = {

    static struct perf_evlist *evsel_list;

    -static struct perf_target target;
    +static struct perf_target target = {
    + .uid = UINT_MAX,
    +};

    static int run_idx = 0;
    static int run_count = 1;
    @@ -1205,20 +1207,12 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)

    perf_target__validate(&target);

    - evsel_list->threads = thread_map__new_str(target.pid,
    - target.tid, UINT_MAX);
    - if (evsel_list->threads == NULL) {
    - pr_err("Problems finding threads of monitor\n");
    - usage_with_options(stat_usage, options);
    - }
    -
    - if (target.system_wide)
    - evsel_list->cpus = cpu_map__new(target.cpu_list);
    - else
    - evsel_list->cpus = cpu_map__dummy_new();
    + if (perf_evlist__create_maps(evsel_list, &target) < 0) {
    + if (!perf_target__no_task(&target))
    + pr_err("Problems finding threads of monitor\n");
    + if (!perf_target__no_cpu(&target))
    + perror("failed to parse CPUs map");

    - if (evsel_list->cpus == NULL) {
    - perror("failed to parse CPUs map");
    usage_with_options(stat_usage, options);
    return -1;
    }
    --
    1.7.10


    \
     
     \ /
      Last update: 2012-04-26 07:23    [W:3.640 / U:0.048 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site