PAPI 7.1.0.0
Loading...
Searching...
No Matches
p4_lst_ins.c File Reference
Include dependency graph for p4_lst_ins.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 16 of file p4_lst_ins.c.

17{
18 int retval, num_tests = 6, tmp;
19 long long **values;
20 int EventSet = PAPI_NULL;
22
23 tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
24
26 if ( retval != PAPI_VER_CURRENT )
27 test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
28
30 if ( hw_info == NULL )
31 test_fail( __FILE__, __LINE__, "PAPI_get_hardware_info", 2 );
32
34 /* Check for Pentium4 */
35 if ( hw_info->cpuid_family != 15 ) {
36 test_skip( __FILE__, __LINE__,
37 "This test is intended only for Pentium 4.", 1 );
38 }
39 } else {
40 test_skip( __FILE__, __LINE__,
41 "This test is intended only for Pentium 4.", 1 );
42 }
43
45 if ( retval != PAPI_OK )
46 test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
47
49
50/* First test: just PAPI_LD_INS */
52 if ( retval != PAPI_OK )
53 test_fail( __FILE__, __LINE__, "PAPI_add_event: PAPI_LD_INS", retval );
54
56 if ( retval != PAPI_OK )
57 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
58
59 do_flops( NUM_FLOPS / 10 );
60
62 if ( retval != PAPI_OK )
63 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
64
66 if ( retval != PAPI_OK )
67 test_fail( __FILE__, __LINE__, "PAPI_remove_event: PAPI_LD_INS",
68 retval );
69
70/* Second test: just PAPI_SR_INS */
72 if ( retval != PAPI_OK )
73 test_fail( __FILE__, __LINE__, "PAPI_add_event: PAPI_SR_INS", retval );
74
76 if ( retval != PAPI_OK )
77 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
78
79 do_flops( NUM_FLOPS / 10 );
80
82 if ( retval != PAPI_OK )
83 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
84
86 if ( retval != PAPI_OK )
87 test_fail( __FILE__, __LINE__, "PAPI_remove_event: PAPI_SR_INS",
88 retval );
89
90/* Third test: just PAPI_LST_INS */
92 if ( retval != PAPI_OK )
93 test_fail( __FILE__, __LINE__, "PAPI_add_event: PAPI_LST_INS", retval );
94
96 if ( retval != PAPI_OK )
97 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
98
99 do_flops( NUM_FLOPS / 10 );
100
102 if ( retval != PAPI_OK )
103 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
104
105/* Fourth test: PAPI_LST_INS and PAPI_LD_INS */
107 if ( retval != PAPI_OK )
108 test_fail( __FILE__, __LINE__, "PAPI_add_event: PAPI_LD_INS", retval );
109
111 if ( retval != PAPI_OK )
112 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
113
114 do_flops( NUM_FLOPS / 10 );
115
117 if ( retval != PAPI_OK )
118 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
119
121 if ( retval != PAPI_OK )
122 test_fail( __FILE__, __LINE__, "PAPI_remove_event: PAPI_LD_INS",
123 retval );
124
125/* Fifth test: PAPI_LST_INS and PAPI_SR_INS */
127 if ( retval != PAPI_OK )
128 test_fail( __FILE__, __LINE__, "PAPI_add_event: PAPI_SR_INS", retval );
129
131 if ( retval != PAPI_OK )
132 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
133
134 do_flops( NUM_FLOPS / 10 );
135
137 if ( retval != PAPI_OK )
138 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
139
141 if ( retval != PAPI_OK )
142 test_fail( __FILE__, __LINE__, "PAPI_remove_event: PAPI_SR_INS",
143 retval );
144
146 if ( retval != PAPI_OK )
147 test_fail( __FILE__, __LINE__, "PAPI_remove_event: PAPI_LST_INS",
148 retval );
149
150/* Sixth test: PAPI_LD_INS and PAPI_SR_INS */
152 if ( retval != PAPI_OK )
153 test_fail( __FILE__, __LINE__, "PAPI_add_event: PAPI_LD_INS", retval );
154
156 if ( retval != PAPI_OK )
157 test_fail( __FILE__, __LINE__, "PAPI_add_event: PAPI_SR_INS", retval );
158
160 if ( retval != PAPI_OK )
161 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
162
163 do_flops( NUM_FLOPS / 10 );
164
166 if ( retval != PAPI_OK )
167 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
168
170 if ( retval != PAPI_OK )
171 test_fail( __FILE__, __LINE__, "PAPI_remove_event: PAPI_LD_INS",
172 retval );
173
175 if ( retval != PAPI_OK )
176 test_fail( __FILE__, __LINE__, "PAPI_remove_event: PAPI_SR_INS",
177 retval );
178
179
180
181 if ( !TESTS_QUIET ) {
182 printf( "Pentium 4 Load / Store tests.\n" );
183 printf
184 ( "These PAPI events are counted by setting a tag at the front of the pipeline,\n" );
185 printf
186 ( "and counting tags at the back of the pipeline. All the tags are the same 'color'\n" );
187 printf
188 ( "and can't be distinguished from each other. Therefore, PAPI_LD_INS and PAPI_SR_INS\n" );
189 printf
190 ( "cannot be counted with the other two events, or the answer will always == PAPI_LST_INS.\n" );
191 printf
192 ( "-------------------------------------------------------------------------------------------\n" );
193 tmp = PAPI_get_opt( PAPI_DEFDOM, NULL );
194 printf( "Default domain is: %d (%s)\n", tmp,
196 tmp = PAPI_get_opt( PAPI_DEFGRN, NULL );
197 printf( "Default granularity is: %d (%s)\n", tmp,
199 printf( "Using %d iterations of c += a*b\n", NUM_FLOPS / 10 );
200 printf
201 ( "-------------------------------------------------------------------------------------------\n" );
202
203 printf
204 ( "Test: 1 2 3 4 5 6\n" );
205 printf( "%s %12lld %12s %12s %12lld %12s %12lld\n", "PAPI_LD_INS: ",
206 ( values[0] )[0], "------", "------", ( values[3] )[1],
207 "------", ( values[5] )[0] );
208 printf( "%s %12s %12lld %12s %12s %12lld %12lld\n", "PAPI_SR_INS: ",
209 "------", ( values[1] )[0], "------", "------",
210 ( values[4] )[1], ( values[5] )[1] );
211 printf( "%s %12s %12s %12lld %12lld %12lld %12s\n", "PAPI_LST_INS:",
212 "------", "------", ( values[2] )[0], ( values[3] )[0],
213 ( values[4] )[0], "------" );
214 printf
215 ( "-------------------------------------------------------------------------------------------\n" );
216
217 printf( "Test 1: PAPI_LD_INS only.\n" );
218 printf( "Test 2: PAPI_SR_INS only.\n" );
219 printf( "Test 3: PAPI_LST_INS only.\n" );
220 printf( "Test 4: PAPI_LD_INS and PAPI_LST_INS.\n" );
221 printf( "Test 5: PAPI_SR_INS and PAPI_LST_INS.\n" );
222 printf( "Test 6: PAPI_LD_INS and PAPI_SR_INS.\n" );
223 printf
224 ( "Verification: Values within each column should be the same.\n" );
225 printf( " R3C3 ~= (R1C1 + R2C2) ~= all other entries.\n" );
226 }
227
228 test_pass( __FILE__ );
229
230 return 0;
231
232}
double tmp
static const PAPI_hw_info_t * hw_info
Definition: byte_profile.c:28
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
get information about the system hardware
Get PAPI library or event set options.
initialize the PAPI library.
removes a hardware event from a PAPI event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
#define PAPI_DEFGRN
Definition: f90papi.h:26
#define PAPI_LST_INS
Definition: f90papi.h:365
#define PAPI_VENDOR_INTEL
Definition: f90papi.h:275
#define PAPI_SR_INS
Definition: f90papi.h:357
#define PAPI_DEFDOM
Definition: f90papi.h:188
#define PAPI_LD_INS
Definition: f90papi.h:292
static int EventSet
Definition: init_fini.c:8
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
void do_flops(int n)
Definition: multiplex.c:23
int TESTS_QUIET
Definition: test_utils.c:18
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
char * stringify_all_domains(int domains)
Definition: test_utils.c:293
char * stringify_granularity(int granularity)
Definition: test_utils.c:353
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
void PAPI_NORETURN test_pass(const char *filename)
Definition: test_utils.c:432
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:584
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
Hardware info structure.
Definition: papi.h:774
int cpuid_family
Definition: papi.h:786
int vendor
Definition: papi.h:781
int num_tests
Definition: zero_fork.c:53
int retval
Definition: zero_fork.c:53
Here is the call graph for this function: