19{
25 double diff;
26
31 long long average=0;
32 int same=0;
33
34
36
40 }
41
43 if ( hwinfo==NULL) {
45 }
46
48
50 if (!
quiet) printf(
"Need at least 1 CPU\n");
51 test_skip( __FILE__, __LINE__,
"num_cpus", 0 );
52 }
53
56 }
57
59
61
65 }
66
67
68
71 test_fail( __FILE__, __LINE__,
"PAPI_assign_eventset_component",
retval );
72 }
73
74
77
80 if (!
quiet) printf(
"Can't PAPI_CPU_ATTACH: %s\n",
83 }
84
89 }
90 }
91
92
95
98 printf(
"Default granularity is: %d (%s)\n",
tmp,
100 }
101
105 printf(
"Eventset[0] granularity is: %d (%s)\n",
options.granularity.granularity,
107 }
108
113 }
114 }
115
116
118
123 }
124 }
125
128 printf ("Event: %s: %10lld on Cpu: %d\n",
130 }
131 }
132
135 }
138 printf("Average: %10lld\n",average);
139 }
140
141
143 diff=((double)
values[
i]-(
double)average)/(
double)average;
144 if ((diff<0.01) && (diff>-0.01)) same++;
145 }
146
147 if (same) {
149 printf("Error! %d events were the same\n",same);
150 }
151 test_fail( __FILE__, __LINE__,
"Too similar", 0 );
152 }
153
155
157
158 return 0;
159
160}
add PAPI preset or native hardware event by name to an EventSet
Assign a component index to an existing but empty EventSet.
Create a new empty PAPI EventSet.
get information about the system hardware
Get PAPI library or event set options.
initialize the PAPI library.
Set PAPI library or event set options.
Finish using PAPI and free all related resources.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
char event_name[2][PAPI_MAX_STR_LEN]
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
char * stringify_granularity(int granularity)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
A pointer to the following is passed to PAPI_set/get_opt()