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

Go to the source code of this file.

Functions

void do_reads (int n)
 
void fdo_reads (int *n)
 
void fdo_reads_ (int *n)
 
void fdo_reads__ (int *n)
 
void FDO_READS (int *n)
 
void _FDO_READS (int *n)
 
void do_flops (int n)
 
void fdo_flops (int *n)
 
void fdo_flops_ (int *n)
 
void fdo_flops__ (int *n)
 
void FDO_FLOPS (int *n)
 
void _FDO_FLOPS (int *n)
 
void do_misses (int n, int bytes)
 
void fdo_misses (int *n, int *size)
 
void fdo_misses_ (int *n, int *size)
 
void fdo_misses__ (int *n, int *size)
 
void FDO_MISSES (int *n, int *size)
 
void _FDO_MISSES (int *n, int *size)
 
void do_flush (void)
 
void fdo_flush (void)
 
void fdo_flush_ (void)
 
void fdo_flush__ (void)
 
void FDO_FLUSH (void)
 
void _FDO_FLUSH (void)
 
void do_l1misses (int n)
 
void fdo_l1misses (int *n)
 
void fdo_l1misses_ (int *n)
 
void fdo_l1misses__ (int *n)
 
void FDO_L1MISSES (int *n)
 
void _FDO_L1MISSES (int *n)
 
void do_stuff (void)
 
void do_stuff_ (void)
 
void do_stuff__ (void)
 
void DO_STUFF (void)
 
void _DO_STUFF (void)
 
void dummy (void *array)
 
void dummy_ (void *array)
 
void dummy__ (void *array)
 
void DUMMY (void *array)
 
void _DUMMY (void *array)
 
void touch_dummy (double *array, int size)
 

Variables

volatile int buf [CACHE_FLUSH_BUFFER_SIZE_INTS]
 
volatile int buf_dummy = 0
 
volatile intflush = NULL
 
volatile int flush_dummy = 0
 
volatile double a = 0.5
 
volatile double b = 2.2
 

Function Documentation

◆ _DO_STUFF()

void _DO_STUFF ( void  )

Definition at line 300 of file do_loops.c.

301{
302 do_stuff( );
303}
void do_stuff(void)
Definition: do_loops.c:256
Here is the call graph for this function:

◆ _DUMMY()

void _DUMMY ( void *  array)

Definition at line 333 of file do_loops.c.

334{
335 ( void ) array;
336}
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23

◆ _FDO_FLOPS()

void _FDO_FLOPS ( int n)

Definition at line 114 of file do_loops.c.

115{
116 do_flops( *n );
117}
void do_flops(int n)
Definition: do_loops.c:78
Here is the call graph for this function:

◆ _FDO_FLUSH()

void _FDO_FLUSH ( void  )

Definition at line 214 of file do_loops.c.

215{
216 do_flush( );
217}
void do_flush(void)
Definition: do_loops.c:172
Here is the call graph for this function:

◆ _FDO_L1MISSES()

void _FDO_L1MISSES ( int n)

Definition at line 250 of file do_loops.c.

251{
252 do_l1misses( *n );
253}
void do_l1misses(int n)
Definition: do_loops.c:220
Here is the call graph for this function:

◆ _FDO_MISSES()

void _FDO_MISSES ( int n,
int size 
)

Definition at line 166 of file do_loops.c.

167{
168 do_misses( *n, *size );
169}
void do_misses(int n, int bytes)
Definition: do_loops.c:120
Here is the call graph for this function:

◆ _FDO_READS()

void _FDO_READS ( int n)

Definition at line 72 of file do_loops.c.

73{
74 do_reads( *n );
75}
void do_reads(int n)
Definition: do_loops.c:19
Here is the call graph for this function:

◆ do_flops()

void do_flops ( int  n)

Definition at line 78 of file do_loops.c.

79{
80 int i;
81 double c = 0.11;
82
83 for ( i = 0; i < n; i++ ) {
84 c += a * b;
85 }
86 dummy( ( void * ) &c );
87}
int i
volatile double b
Definition: do_loops.c:16
volatile double a
Definition: do_loops.c:16
void dummy(void *array)
Definition: do_loops.c:306
static double c[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:40
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_flush()

void do_flush ( void  )

Definition at line 172 of file do_loops.c.

173{
174 register int i;
175 if ( flush == NULL )
176 flush = ( int * ) malloc( ( 1024 * 1024 * 16 ) * sizeof ( int ) );
177 if ( !flush )
178 return;
179
180 dummy( ( void * ) flush );
181 for ( i = 0; i < ( 1024 * 1024 * 16 ); i++ ) {
182 flush[i] += flush_dummy;
183 }
184 flush_dummy++;
185 dummy( ( void * ) flush );
186 dummy( ( void * ) &flush_dummy );
187}
volatile int * flush
Definition: do_loops.c:14
volatile int flush_dummy
Definition: do_loops.c:15
int
Definition: sde_internal.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_l1misses()

void do_l1misses ( int  n)

Definition at line 220 of file do_loops.c.

221{
223}
#define L1_MISS_BUFFER_SIZE_INTS
Definition: do_loops.h:11
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_misses()

void do_misses ( int  n,
int  bytes 
)

Definition at line 120 of file do_loops.c.

121{
122 register int i, j, tmp = buf_dummy, len = bytes / ( int ) sizeof ( int );
123 dummy( ( void * ) buf );
124 dummy( ( void * ) &buf_dummy );
125 assert( len <= CACHE_FLUSH_BUFFER_SIZE_INTS );
126 for ( j = 0; j < n; j++ ) {
127 for ( i = 0; i < len; i++ ) {
128 /* We need to read, modify, write here to look
129 out for the write allocate policies. */
130 buf[i] += tmp;
131 /* Fake out some naive prefetchers */
132 buf[len - 1 - i] -= tmp;
133 }
134 tmp += len;
135 }
136 buf_dummy = tmp;
137 dummy( ( void * ) buf );
138 dummy( ( void * ) &buf_dummy );
139}
double tmp
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
volatile int buf_dummy
Definition: do_loops.c:13
#define CACHE_FLUSH_BUFFER_SIZE_INTS
Definition: do_loops.h:12
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_reads()

void do_reads ( int  n)

Definition at line 19 of file do_loops.c.

20{
21 int i, retval;
22 static int fd = -1;
23 char buf;
24
25 if ( fd == -1 ) {
26 fd = open( "/dev/zero", O_RDONLY );
27 if ( fd == -1 ) {
28 perror( "open(/dev/zero)" );
29 exit( 1 );
30 }
31 }
32
33 for ( i = 0; i < n; i++ ) {
34 retval = ( int ) read( fd, &buf, sizeof ( buf ) );
35 if ( retval != sizeof ( buf ) ) {
36 if ( retval < 0 )
37 perror( "/dev/zero cannot be read" );
38 else
39 fprintf( stderr,
40 "/dev/zero cannot be read: only got %d bytes.\n",
41 retval );
42 exit( 1 );
43 }
44 }
45}
int open(const char *pathname, int flags, mode_t mode)
Definition: appio.c:188
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:229
FILE * stderr
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_stuff()

void do_stuff ( void  )

Definition at line 256 of file do_loops.c.

257{
258 static int loops = 0;
259
260 if ( loops == 0 ) {
261 struct timeval now, then;
262 gettimeofday( &then, NULL );
263 do {
266 do_misses( 1, 1024 * 1024 );
267 gettimeofday( &now, NULL );
268 loops++;
269 } while ( now.tv_sec - then.tv_sec < NUM_WORK_SECONDS );
270 } else {
271 int i = 0;
272 do {
275 do_misses( 1, 1024 * 1024 );
276 i++;
277 } while ( i < loops );
278 }
279}
#define NUM_READS
Definition: do_loops.h:4
#define NUM_WORK_SECONDS
Definition: do_loops.h:1
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DO_STUFF()

void DO_STUFF ( void  )

Definition at line 294 of file do_loops.c.

295{
296 do_stuff( );
297}
Here is the call graph for this function:

◆ do_stuff_()

void do_stuff_ ( void  )

Definition at line 282 of file do_loops.c.

283{
284 do_stuff( );
285}
Here is the call graph for this function:

◆ do_stuff__()

void do_stuff__ ( void  )

Definition at line 288 of file do_loops.c.

289{
290 do_stuff( );
291}
Here is the call graph for this function:

◆ dummy()

void dummy ( void *  array)

Definition at line 306 of file do_loops.c.

307{
308/* Confuse the compiler so as not to optimize
309 away the flops in the calling routine */
310/* Cast the array as a void to eliminate unused argument warning */
311 ( void ) array;
312}
Here is the caller graph for this function:

◆ DUMMY()

void DUMMY ( void *  array)

Definition at line 327 of file do_loops.c.

328{
329 ( void ) array;
330}

◆ dummy_()

void dummy_ ( void *  array)

Definition at line 315 of file do_loops.c.

316{
317 ( void ) array;
318}

◆ dummy__()

void dummy__ ( void *  array)

Definition at line 321 of file do_loops.c.

322{
323 ( void ) array;
324}

◆ fdo_flops()

void fdo_flops ( int n)

Definition at line 90 of file do_loops.c.

91{
92 do_flops( *n );
93}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FDO_FLOPS()

void FDO_FLOPS ( int n)

Definition at line 108 of file do_loops.c.

109{
110 do_flops( *n );
111}
Here is the call graph for this function:

◆ fdo_flops_()

void fdo_flops_ ( int n)

Definition at line 96 of file do_loops.c.

97{
98 do_flops( *n );
99}
Here is the call graph for this function:

◆ fdo_flops__()

void fdo_flops__ ( int n)

Definition at line 102 of file do_loops.c.

103{
104 do_flops( *n );
105}
Here is the call graph for this function:

◆ fdo_flush()

void fdo_flush ( void  )

Definition at line 190 of file do_loops.c.

191{
192 do_flush( );
193}
Here is the call graph for this function:

◆ FDO_FLUSH()

void FDO_FLUSH ( void  )

Definition at line 208 of file do_loops.c.

209{
210 do_flush( );
211}
Here is the call graph for this function:

◆ fdo_flush_()

void fdo_flush_ ( void  )

Definition at line 196 of file do_loops.c.

197{
198 do_flush( );
199}
Here is the call graph for this function:

◆ fdo_flush__()

void fdo_flush__ ( void  )

Definition at line 202 of file do_loops.c.

203{
204 do_flush( );
205}
Here is the call graph for this function:

◆ fdo_l1misses()

void fdo_l1misses ( int n)

Definition at line 226 of file do_loops.c.

227{
228 do_l1misses( *n );
229}
Here is the call graph for this function:

◆ FDO_L1MISSES()

void FDO_L1MISSES ( int n)

Definition at line 244 of file do_loops.c.

245{
246 do_l1misses( *n );
247}
Here is the call graph for this function:

◆ fdo_l1misses_()

void fdo_l1misses_ ( int n)

Definition at line 232 of file do_loops.c.

233{
234 do_l1misses( *n );
235}
Here is the call graph for this function:

◆ fdo_l1misses__()

void fdo_l1misses__ ( int n)

Definition at line 238 of file do_loops.c.

239{
240 do_l1misses( *n );
241}
Here is the call graph for this function:

◆ fdo_misses()

void fdo_misses ( int n,
int size 
)

Definition at line 142 of file do_loops.c.

143{
144 do_misses( *n, *size );
145}
Here is the call graph for this function:

◆ FDO_MISSES()

void FDO_MISSES ( int n,
int size 
)

Definition at line 160 of file do_loops.c.

161{
162 do_misses( *n, *size );
163}
Here is the call graph for this function:

◆ fdo_misses_()

void fdo_misses_ ( int n,
int size 
)

Definition at line 148 of file do_loops.c.

149{
150 do_misses( *n, *size );
151}
Here is the call graph for this function:

◆ fdo_misses__()

void fdo_misses__ ( int n,
int size 
)

Definition at line 154 of file do_loops.c.

155{
156 do_misses( *n, *size );
157}
Here is the call graph for this function:

◆ fdo_reads()

void fdo_reads ( int n)

Definition at line 48 of file do_loops.c.

49{
50 do_reads( *n );
51}
Here is the call graph for this function:

◆ FDO_READS()

void FDO_READS ( int n)

Definition at line 66 of file do_loops.c.

67{
68 do_reads( *n );
69}
Here is the call graph for this function:

◆ fdo_reads_()

void fdo_reads_ ( int n)

Definition at line 54 of file do_loops.c.

55{
56 do_reads( *n );
57}
Here is the call graph for this function:

◆ fdo_reads__()

void fdo_reads__ ( int n)

Definition at line 60 of file do_loops.c.

61{
62 do_reads( *n );
63}
Here is the call graph for this function:

◆ touch_dummy()

void touch_dummy ( double *  array,
int  size 
)

Definition at line 343 of file do_loops.c.

344{
345 int i;
346 double *tmp = array;
347 for ( i = 0; i < size; i++, tmp++ )
348 *tmp = ( double ) rand( );
349}
Here is the caller graph for this function:

Variable Documentation

◆ a

volatile double a = 0.5

Definition at line 16 of file do_loops.c.

◆ b

volatile double b = 2.2

Definition at line 16 of file do_loops.c.

◆ buf

Definition at line 12 of file do_loops.c.

◆ buf_dummy

volatile int buf_dummy = 0

Definition at line 13 of file do_loops.c.

◆ flush

volatile int* flush = NULL

Definition at line 14 of file do_loops.c.

◆ flush_dummy

volatile int flush_dummy = 0

Definition at line 15 of file do_loops.c.