20 {
21
26 int uncore_cidx=-1;
29 struct utsname uname_info;
30
31
33
34 uname(&uname_info);
35 if (!
quiet) printf(
"Found Linux %s\n",uname_info.release);
36
37
41 }
42
43
45 if ( hwinfo == NULL ) {
46 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 0 );
47 }
48
50 if (!
quiet) printf(
"Test only for AMD machines\n");
51 test_skip(__FILE__,__LINE__,
"Test only for AMD processor",0);
52 }
53
55 if (!
quiet) printf(
"Test only for fam15h AMD machines\n");
56 test_skip(__FILE__,__LINE__,
"Test only for fam15h AMD processor",0);
57 }
58
59 if (!strcmp(uname_info.release,"3.9")) {
60
61 if (!
quiet) printf(
"Detected 3.9 kernel, using perf_event\n");
62
63
64
65
67 if (uncore_cidx<0) {
68 test_skip(__FILE__,__LINE__,
"perf_event component not found",0);
69 }
70
71
72 strncpy(
event_name,
"DRAM_ACCESSES:ALL", BUFSIZ);
73 }
74 else {
75
76
77
79 printf("Detected > 3.9 kernel, using perf_event_uncore\n");
80 }
81
82
84 if (uncore_cidx<0) {
85 test_skip(__FILE__,__LINE__,
"perf_event_uncore component not found",0);
86 }
87
88
89
90 strncpy(
event_name,
"DRAM_ACCESSES:ALL", BUFSIZ);
91 }
92
93
97 }
98
99
101
102
103
105
108
112 "this test; trying to PAPI_CPU_ATTACH; need to run as root",
114 }
115
116
117
119
123
127 "this test; trying to set PAPI_GRN_SYS",
129 }
130
131
132
134
138
142 "this test; trying to set PAPI_DOM_ALL; need to run as root",
144 }
145
146
151 }
153 }
154
155
156
160 }
161
162
164
165
169 }
170
172 printf("AMD fam15h Northbridge test:\n");
175 }
176
178
179 return 0;
180}
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.
returns the component index for the named component
get information about the system hardware
initialize the PAPI library.
Set PAPI library or event set options.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
char event_name[2][PAPI_MAX_STR_LEN]
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
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()