|
@@ -312,8 +312,12 @@ static int read_counter(struct perf_evsel *counter)
|
|
|
struct perf_counts_values *count;
|
|
|
|
|
|
count = perf_counts(counter->counts, cpu, thread);
|
|
|
- if (perf_evsel__read(counter, cpu, thread, count))
|
|
|
+ if (perf_evsel__read(counter, cpu, thread, count)) {
|
|
|
+ counter->counts->scaled = -1;
|
|
|
+ perf_counts(counter->counts, cpu, thread)->ena = 0;
|
|
|
+ perf_counts(counter->counts, cpu, thread)->run = 0;
|
|
|
return -1;
|
|
|
+ }
|
|
|
|
|
|
if (STAT_RECORD) {
|
|
|
if (perf_evsel__write_stat_event(counter, cpu, thread, count)) {
|
|
@@ -338,12 +342,14 @@ static int read_counter(struct perf_evsel *counter)
|
|
|
static void read_counters(void)
|
|
|
{
|
|
|
struct perf_evsel *counter;
|
|
|
+ int ret;
|
|
|
|
|
|
evlist__for_each_entry(evsel_list, counter) {
|
|
|
- if (read_counter(counter))
|
|
|
+ ret = read_counter(counter);
|
|
|
+ if (ret)
|
|
|
pr_debug("failed to read counter %s\n", counter->name);
|
|
|
|
|
|
- if (perf_stat_process_counter(&stat_config, counter))
|
|
|
+ if (ret == 0 && perf_stat_process_counter(&stat_config, counter))
|
|
|
pr_warning("failed to process counter %s\n", counter->name);
|
|
|
}
|
|
|
}
|