Re: [PATCH 2/2] perf tests: Add a test case for checking sw clockevent frequency

From: Arnaldo Carvalho de Melo
Date: Mon Mar 18 2013 - 10:42:58 EST


Em Mon, Mar 18, 2013 at 11:41:47AM +0900, Namhyung Kim escreveu:
> +static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
> +{
> + int i, err = -1;
> + volatile int tmp = 0;
> + u64 total_periods = 0;
> + int nr_samples = 0;
> + union perf_event *event;
> + struct perf_evsel *evsel;
> + struct perf_evlist *evlist;
> + struct perf_event_attr attr = {
> + .type = PERF_TYPE_SOFTWARE,
> + .config = clock_id,
> + .sample_type = PERF_SAMPLE_PERIOD,
> + .exclude_kernel = 1,
> + .disabled = 1,
> + .freq = 1,
> + .sample_freq = 10000,
> + };

In some compilers we get:

tests/sw-clock.c: In function â__test__sw_clock_freqâ:
tests/sw-clock.c:35: error: unknown field âsample_freqâ specified in initializer

So I'm moving the initialization to outside the struct named initialization block, i.e.:

@@ -32,9 +32,10 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
.exclude_kernel = 1,
.disabled = 1,
.freq = 1,
- .sample_freq = 10000,
};

+ attr.sample_freq = 10000;
+

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/