PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

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:

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
void
Definition: iozone.c:18627
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: multiplex.c:23

Here is the call graph for this function:

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:

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:

void _FDO_MISSES ( int n,
int size 
)

Definition at line 166 of file do_loops.c.

167 {
168  do_misses( *n, *size );
169 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:120

Here is the call graph for this function:

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:

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 }
double c
Definition: multiplex.c:22
int dummy
Definition: iozone.c:19741
int i
Definition: fileop.c:140
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
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_dummy
Definition: do_loops.c:15
int dummy
Definition: iozone.c:19741
volatile int * flush
Definition: do_loops.c:14
int i
Definition: fileop.c:140
int
Definition: iozone.c:18528

Here is the caller graph for this function:

void do_l1misses ( int  n)

Definition at line 220 of file do_loops.c.

221 {
223 }
void do_misses(int n, int bytes)
Definition: do_loops.c:120
#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:

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 }
#define CACHE_FLUSH_BUFFER_SIZE_INTS
Definition: do_loops.h:12
int dummy
Definition: iozone.c:19741
int i
Definition: fileop.c:140
char buf[200]
Definition: iozone.c:19609
int
Definition: iozone.c:18528
long j
Definition: iozone.c:19135
long long tmp
Definition: iozone.c:12031
volatile int buf_dummy
Definition: do_loops.c:13

Here is the caller graph for this function:

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 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
int fd
Definition: iozone.c:1291
int open(const char *pathname, int flags, mode_t mode)
Definition: appio.c:184
int i
Definition: fileop.c:140
char buf[200]
Definition: iozone.c:19609
int
Definition: iozone.c:18528
ssize_t retval
Definition: libasync.c:338
void exit()

Here is the call graph for this function:

Here is the caller graph for this function:

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 {
264  do_flops( NUM_FLOPS );
265  do_reads( NUM_READS );
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 {
273  do_flops( NUM_FLOPS );
274  do_reads( NUM_READS );
275  do_misses( 1, 1024 * 1024 );
276  i++;
277  } while ( i < loops );
278  }
279 }
void do_reads(int n)
Definition: do_loops.c:19
#define NUM_WORK_SECONDS
Definition: do_loops.h:1
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
#define NUM_READS
Definition: do_loops.h:4
int i
Definition: fileop.c:140
void do_misses(int n, int bytes)
Definition: do_loops.c:120
void do_flops(int n)
Definition: multiplex.c:23
int gettimeofday(void *ptr1, void *ptr2)

Here is the call graph for this function:

Here is the caller graph for this function:

void DO_STUFF ( void  )

Definition at line 294 of file do_loops.c.

295 {
296  do_stuff( );
297 }
void do_stuff(void)
Definition: do_loops.c:256

Here is the call graph for this function:

void do_stuff_ ( void  )

Definition at line 282 of file do_loops.c.

283 {
284  do_stuff( );
285 }
void do_stuff(void)
Definition: do_loops.c:256

Here is the call graph for this function:

void do_stuff__ ( void  )

Definition at line 288 of file do_loops.c.

289 {
290  do_stuff( );
291 }
void do_stuff(void)
Definition: do_loops.c:256

Here is the call graph for this function:

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 }
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
void
Definition: iozone.c:18627
void DUMMY ( void array)

Definition at line 327 of file do_loops.c.

328 {
329  ( void ) array;
330 }
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
void
Definition: iozone.c:18627
void dummy_ ( void array)

Definition at line 315 of file do_loops.c.

316 {
317  ( void ) array;
318 }
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
void
Definition: iozone.c:18627
void dummy__ ( void array)

Definition at line 321 of file do_loops.c.

322 {
323  ( void ) array;
324 }
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
void
Definition: iozone.c:18627
void fdo_flops ( int n)

Definition at line 90 of file do_loops.c.

91 {
92  do_flops( *n );
93 }
void do_flops(int n)
Definition: multiplex.c:23

Here is the call graph for this function:

Here is the caller graph for this function:

void FDO_FLOPS ( int n)

Definition at line 108 of file do_loops.c.

109 {
110  do_flops( *n );
111 }
void do_flops(int n)
Definition: multiplex.c:23

Here is the call graph for this function:

void fdo_flops_ ( int n)

Definition at line 96 of file do_loops.c.

97 {
98  do_flops( *n );
99 }
void do_flops(int n)
Definition: multiplex.c:23

Here is the call graph for this function:

void fdo_flops__ ( int n)

Definition at line 102 of file do_loops.c.

103 {
104  do_flops( *n );
105 }
void do_flops(int n)
Definition: multiplex.c:23

Here is the call graph for this function:

void fdo_flush ( void  )

Definition at line 190 of file do_loops.c.

191 {
192  do_flush( );
193 }
void do_flush(void)
Definition: do_loops.c:172

Here is the call graph for this function:

void FDO_FLUSH ( void  )

Definition at line 208 of file do_loops.c.

209 {
210  do_flush( );
211 }
void do_flush(void)
Definition: do_loops.c:172

Here is the call graph for this function:

void fdo_flush_ ( void  )

Definition at line 196 of file do_loops.c.

197 {
198  do_flush( );
199 }
void do_flush(void)
Definition: do_loops.c:172

Here is the call graph for this function:

void fdo_flush__ ( void  )

Definition at line 202 of file do_loops.c.

203 {
204  do_flush( );
205 }
void do_flush(void)
Definition: do_loops.c:172

Here is the call graph for this function:

void fdo_l1misses ( int n)

Definition at line 226 of file do_loops.c.

227 {
228  do_l1misses( *n );
229 }
void do_l1misses(int n)
Definition: do_loops.c:220

Here is the call graph for this function:

void FDO_L1MISSES ( int n)

Definition at line 244 of file do_loops.c.

245 {
246  do_l1misses( *n );
247 }
void do_l1misses(int n)
Definition: do_loops.c:220

Here is the call graph for this function:

void fdo_l1misses_ ( int n)

Definition at line 232 of file do_loops.c.

233 {
234  do_l1misses( *n );
235 }
void do_l1misses(int n)
Definition: do_loops.c:220

Here is the call graph for this function:

void fdo_l1misses__ ( int n)

Definition at line 238 of file do_loops.c.

239 {
240  do_l1misses( *n );
241 }
void do_l1misses(int n)
Definition: do_loops.c:220

Here is the call graph for this function:

void fdo_misses ( int n,
int size 
)

Definition at line 142 of file do_loops.c.

143 {
144  do_misses( *n, *size );
145 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:120

Here is the call graph for this function:

void FDO_MISSES ( int n,
int size 
)

Definition at line 160 of file do_loops.c.

161 {
162  do_misses( *n, *size );
163 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:120

Here is the call graph for this function:

void fdo_misses_ ( int n,
int size 
)

Definition at line 148 of file do_loops.c.

149 {
150  do_misses( *n, *size );
151 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:120

Here is the call graph for this function:

void fdo_misses__ ( int n,
int size 
)

Definition at line 154 of file do_loops.c.

155 {
156  do_misses( *n, *size );
157 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:120

Here is the call graph for this function:

void fdo_reads ( int n)

Definition at line 48 of file do_loops.c.

49 {
50  do_reads( *n );
51 }
void do_reads(int n)
Definition: do_loops.c:19

Here is the call graph for this function:

void FDO_READS ( int n)

Definition at line 66 of file do_loops.c.

67 {
68  do_reads( *n );
69 }
void do_reads(int n)
Definition: do_loops.c:19

Here is the call graph for this function:

void fdo_reads_ ( int n)

Definition at line 54 of file do_loops.c.

55 {
56  do_reads( *n );
57 }
void do_reads(int n)
Definition: do_loops.c:19

Here is the call graph for this function:

void fdo_reads__ ( int n)

Definition at line 60 of file do_loops.c.

61 {
62  do_reads( *n );
63 }
void do_reads(int n)
Definition: do_loops.c:19

Here is the call graph for this function:

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 }
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
int i
Definition: fileop.c:140
char *long long size
Definition: iozone.c:12023
int rand()
long long tmp
Definition: iozone.c:12031

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

volatile double a = 0.5

Definition at line 16 of file do_loops.c.

volatile double b = 2.2

Definition at line 16 of file do_loops.c.

Definition at line 12 of file do_loops.c.

volatile int buf_dummy = 0

Definition at line 13 of file do_loops.c.

volatile int* flush = NULL

Definition at line 14 of file do_loops.c.

volatile int flush_dummy = 0

Definition at line 15 of file do_loops.c.