block: decouple REQ_OP_SECURE_ERASE from REQ_OP_DISCARD
[linux-2.6-microblaze.git] / tools / perf / builtin-stat.c
index 3f98689..a96f106 100644 (file)
@@ -804,7 +804,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
        if (group)
                evlist__set_leader(evsel_list);
 
-       if (!cpu_map__is_dummy(evsel_list->core.cpus)) {
+       if (!cpu_map__is_dummy(evsel_list->core.user_requested_cpus)) {
                if (affinity__setup(&saved_affinity) < 0)
                        return -1;
                affinity = &saved_affinity;
@@ -955,10 +955,10 @@ try_again_reset:
         * Enable counters and exec the command:
         */
        if (forks) {
-               evlist__start_workload(evsel_list);
                err = enable_counters();
                if (err)
                        return -1;
+               evlist__start_workload(evsel_list);
 
                t0 = rdclock();
                clock_gettime(CLOCK_MONOTONIC, &ref_time);
@@ -1458,7 +1458,7 @@ static int perf_stat_init_aggr_mode(void)
        aggr_cpu_id_get_t get_id = aggr_mode__get_aggr(stat_config.aggr_mode);
 
        if (get_id) {
-               stat_config.aggr_map = cpu_aggr_map__new(evsel_list->core.cpus,
+               stat_config.aggr_map = cpu_aggr_map__new(evsel_list->core.user_requested_cpus,
                                                         get_id, /*data=*/NULL);
                if (!stat_config.aggr_map) {
                        pr_err("cannot build %s map", aggr_mode__string[stat_config.aggr_mode]);
@@ -1472,7 +1472,10 @@ static int perf_stat_init_aggr_mode(void)
         * taking the highest cpu number to be the size of
         * the aggregation translate cpumap.
         */
-       nr = perf_cpu_map__max(evsel_list->core.cpus).cpu;
+       if (evsel_list->core.user_requested_cpus)
+               nr = perf_cpu_map__max(evsel_list->core.user_requested_cpus).cpu;
+       else
+               nr = 0;
        stat_config.cpus_aggr_map = cpu_aggr_map__empty_new(nr + 1);
        return stat_config.cpus_aggr_map ? 0 : -ENOMEM;
 }
@@ -1627,7 +1630,7 @@ static int perf_stat_init_aggr_mode_file(struct perf_stat *st)
        if (!get_id)
                return 0;
 
-       stat_config.aggr_map = cpu_aggr_map__new(evsel_list->core.cpus, get_id, env);
+       stat_config.aggr_map = cpu_aggr_map__new(evsel_list->core.user_requested_cpus, get_id, env);
        if (!stat_config.aggr_map) {
                pr_err("cannot build %s map", aggr_mode__string[stat_config.aggr_mode]);
                return -1;
@@ -2271,11 +2274,11 @@ int cmd_stat(int argc, const char **argv)
        } else
                stat_config.csv_sep = DEFAULT_SEPARATOR;
 
-       if (argc && !strncmp(argv[0], "rec", 3)) {
+       if (argc && strlen(argv[0]) > 2 && strstarts("record", argv[0])) {
                argc = __cmd_record(argc, argv);
                if (argc < 0)
                        return -1;
-       } else if (argc && !strncmp(argv[0], "rep", 3))
+       } else if (argc && strlen(argv[0]) > 2 && strstarts("report", argv[0]))
                return __cmd_report(argc, argv);
 
        interval = stat_config.interval;