2 #include "perfcounters.h"
4 static unsigned __perf_counter
[PERF_COUNTERS
];
6 static inline int __builtin_mfcp2(int k
)
13 ".set pop" : "=r" (r
) : "i" (k
));
18 void perfmon_start(void)
23 * We have to use the macro construct as mfc2 requires a constant
24 * argument and this is simpler than generating code on the fly.
27 #define X(H) __perf_counter[H] = -__builtin_mfcp2(H);
28 __FORALL_PERF_COUNTERS(X
);
32 void perfmon_report(void)
36 #define X(H) __perf_counter[H] += __builtin_mfcp2(H);
37 __FORALL_PERF_COUNTERS(X
);
40 for (i
= 0; i
< PERF_COUNTERS
; ++i
)
41 printf("%s = %d\n", __perf_counter_names
[i
], __perf_counter
[i
]);