From: Cyril H. <ch...@su...> - 2012-01-05 14:33:46
|
Hi! > >From 85050140d0c6de1cedb538ef42bd8a106e4075ef Mon Sep 17 00:00:00 2001 > From: Xu,Anhua <anh...@in...> > Date: Mon, 28 Nov 2011 15:48:31 +0800 > Subject: [PATCH] perfcounter01: Update calling for perf_event_open > > Since perf_event_open API changed a lot, the original calling no long > worked Plese write a better description than "things have changes". From the patch bellow it looks like syscall parameter format have changed from integer to structure. > /* Harness Specific Include Files. */ > #include "test.h" > #include "usctest.h" > @@ -49,13 +51,15 @@ extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */ > char *TCID = "performance_counter01"; /* test program identifier. */ > int TST_TOTAL = 1; > > -enum hw_event_types { > - PERF_COUNT_CYCLES, > - PERF_COUNT_INSTRUCTIONS, > - PERF_COUNT_CACHE_REFERENCES, > - PERF_COUNT_CACHE_MISSES, > - PERF_COUNT_BRANCH_INSTRUCTIONS, > - PERF_COUNT_BRANCH_MISSES, > +static struct perf_event_attr default_attrs[] = { > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES }, > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_BACKEND }, > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS }, > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES }, > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES }, > + { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES }, > }; Please tremove the extra spaces before the closing bracket. > void cleanup(void) { /* Stub function. */ } > @@ -67,13 +71,13 @@ main(void) { > int fd1, fd2, ret; > > fd1 = syscall(__NR_perf_event_open, > - PERF_COUNT_INSTRUCTIONS, 0, 0, 0, -1); > + &default_attrs[3], 0, -1, -1, 0); > if (fd1 < 0) { > tst_brkm(TBROK | TERRNO, cleanup, > "Failed to create PERF_COUNT_INSTRUCTIONS fd"); > } > fd2 = syscall(__NR_perf_event_open, > - PERF_COUNT_CACHE_MISSES, 0, 0, 0, -1); > + &default_attrs[6], 0, -1, -1, 0); > if (fd2 < 0) { > tst_brkm(TBROK | TERRNO, cleanup, > "Failed to create PERF_COUNT_CACHE_MISSES fd"); > @@ -104,3 +108,5 @@ main(void) { > tst_exit(); > > } The rest of the patch seems straightforward, please run it trought checkpatch (which is part of linux kernel sources) before resending. -- Cyril Hrubis ch...@su... |