PAPI  5.3.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)
 

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 293 of file do_loops.c.

294 {
295  do_stuff( );
296 }
void do_stuff(void)
Definition: do_loops.c:249

Here is the call graph for this function:

void _FDO_FLOPS ( int n)

Definition at line 107 of file do_loops.c.

108 {
109  do_flops( *n );
110 }
void do_flops(int n)
Definition: multiplex.c:23
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void _FDO_FLUSH ( void  )

Definition at line 207 of file do_loops.c.

208 {
209  do_flush( );
210 }
void do_flush(void)
Definition: do_loops.c:165

Here is the call graph for this function:

void _FDO_L1MISSES ( int n)

Definition at line 243 of file do_loops.c.

244 {
245  do_l1misses( *n );
246 }
void do_l1misses(int n)
Definition: do_loops.c:213
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void _FDO_MISSES ( int n,
int size 
)

Definition at line 159 of file do_loops.c.

160 {
161  do_misses( *n, *size );
162 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:113
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void _FDO_READS ( int n)

Definition at line 65 of file do_loops.c.

66 {
67  do_reads( *n );
68 }
void do_reads(int n)
Definition: do_loops.c:12
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void do_flops ( int  n)

Definition at line 71 of file do_loops.c.

72 {
73  int i;
74  double c = 0.11;
75 
76  for ( i = 0; i < n; i++ ) {
77  c += a * b;
78  }
79  dummy( ( void * ) &c );
80 }
double c
Definition: multiplex.c:22
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
int dummy
Definition: iozone.c:19741
int i
Definition: fileop.c:140
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:38
int n
Definition: mendes-alt.c:164
void do_flush ( void  )

Definition at line 165 of file do_loops.c.

166 {
167  register int i;
168  if ( flush == NULL )
169  flush = ( int * ) malloc( ( 1024 * 1024 * 16 ) * sizeof ( int ) );
170  if ( !flush )
171  return;
172 
173  dummy( ( void * ) flush );
174  for ( i = 0; i < ( 1024 * 1024 * 16 ); i++ ) {
175  flush[i] += flush_dummy;
176  }
177  flush_dummy++;
178  dummy( ( void * ) flush );
179  dummy( ( void * ) &flush_dummy );
180 }
volatile int flush_dummy
Definition: do_loops.c:8
int dummy
Definition: iozone.c:19741
volatile int * flush
Definition: do_loops.c:7
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 213 of file do_loops.c.

214 {
216 }
void do_misses(int n, int bytes)
Definition: do_loops.c:113
#define L1_MISS_BUFFER_SIZE_INTS
Definition: test_utils.h:11
int n
Definition: mendes-alt.c:164

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 113 of file do_loops.c.

114 {
115  register int i, j, tmp = buf_dummy, len = bytes / ( int ) sizeof ( int );
116  dummy( ( void * ) buf );
117  dummy( ( void * ) &buf_dummy );
118  assert( len <= CACHE_FLUSH_BUFFER_SIZE_INTS );
119  for ( j = 0; j < n; j++ ) {
120  for ( i = 0; i < len; i++ ) {
121  /* We need to read, modify, write here to look
122  out for the write allocate policies. */
123  buf[i] += tmp;
124  /* Fake out some naive prefetchers */
125  buf[len - 1 - i] -= tmp;
126  }
127  tmp += len;
128  }
129  buf_dummy = tmp;
130  dummy( ( void * ) buf );
131  dummy( ( void * ) &buf_dummy );
132 }
int dummy
Definition: iozone.c:19741
int i
Definition: fileop.c:140
char buf[200]
Definition: iozone.c:19609
#define CACHE_FLUSH_BUFFER_SIZE_INTS
Definition: test_utils.h:12
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:6
int n
Definition: mendes-alt.c:164

Here is the caller graph for this function:

void do_reads ( int  n)

Definition at line 12 of file do_loops.c.

13 {
14  int i, retval;
15  static int fd = -1;
16  char buf;
17 
18  if ( fd == -1 ) {
19  fd = open( "/dev/zero", O_RDONLY );
20  if ( fd == -1 ) {
21  perror( "open(/dev/zero)" );
22  exit( 1 );
23  }
24  }
25 
26  for ( i = 0; i < n; i++ ) {
27  retval = ( int ) read( fd, &buf, sizeof ( buf ) );
28  if ( retval != sizeof ( buf ) ) {
29  if ( retval < 0 )
30  perror( "/dev/zero cannot be read" );
31  else
32  fprintf( stderr,
33  "/dev/zero cannot be read: only got %d bytes.\n",
34  retval );
35  exit( 1 );
36  }
37  }
38 }
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()
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

Here is the caller graph for this function:

void do_stuff ( void  )

Definition at line 249 of file do_loops.c.

250 {
251  static int loops = 0;
252 
253  if ( loops == 0 ) {
254  struct timeval now, then;
255  gettimeofday( &then, NULL );
256  do {
257  do_flops( NUM_FLOPS );
258  do_reads( NUM_READS );
259  do_misses( 1, 1024 * 1024 );
260  gettimeofday( &now, NULL );
261  loops++;
262  } while ( now.tv_sec - then.tv_sec < NUM_WORK_SECONDS );
263  } else {
264  int i = 0;
265  do {
266  do_flops( NUM_FLOPS );
267  do_reads( NUM_READS );
268  do_misses( 1, 1024 * 1024 );
269  i++;
270  } while ( i < loops );
271  }
272 }
#define NUM_FLOPS
void do_reads(int n)
Definition: do_loops.c:12
int i
Definition: fileop.c:140
#define NUM_WORK_SECONDS
Definition: test_utils.h:1
void do_misses(int n, int bytes)
Definition: do_loops.c:113
void do_flops(int n)
Definition: multiplex.c:23
#define NUM_READS
Definition: test_utils.h:4

Here is the call graph for this function:

Here is the caller graph for this function:

void DO_STUFF ( void  )

Definition at line 287 of file do_loops.c.

288 {
289  do_stuff( );
290 }
void do_stuff(void)
Definition: do_loops.c:249

Here is the call graph for this function:

void do_stuff_ ( void  )

Definition at line 275 of file do_loops.c.

276 {
277  do_stuff( );
278 }
void do_stuff(void)
Definition: do_loops.c:249

Here is the call graph for this function:

void do_stuff__ ( void  )

Definition at line 281 of file do_loops.c.

282 {
283  do_stuff( );
284 }
void do_stuff(void)
Definition: do_loops.c:249

Here is the call graph for this function:

void fdo_flops ( int n)

Definition at line 83 of file do_loops.c.

84 {
85  do_flops( *n );
86 }
void do_flops(int n)
Definition: multiplex.c:23
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

Here is the caller graph for this function:

void FDO_FLOPS ( int n)

Definition at line 101 of file do_loops.c.

102 {
103  do_flops( *n );
104 }
void do_flops(int n)
Definition: multiplex.c:23
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_flops_ ( int n)

Definition at line 89 of file do_loops.c.

90 {
91  do_flops( *n );
92 }
void do_flops(int n)
Definition: multiplex.c:23
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_flops__ ( int n)

Definition at line 95 of file do_loops.c.

96 {
97  do_flops( *n );
98 }
void do_flops(int n)
Definition: multiplex.c:23
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_flush ( void  )

Definition at line 183 of file do_loops.c.

184 {
185  do_flush( );
186 }
void do_flush(void)
Definition: do_loops.c:165

Here is the call graph for this function:

void FDO_FLUSH ( void  )

Definition at line 201 of file do_loops.c.

202 {
203  do_flush( );
204 }
void do_flush(void)
Definition: do_loops.c:165

Here is the call graph for this function:

void fdo_flush_ ( void  )

Definition at line 189 of file do_loops.c.

190 {
191  do_flush( );
192 }
void do_flush(void)
Definition: do_loops.c:165

Here is the call graph for this function:

void fdo_flush__ ( void  )

Definition at line 195 of file do_loops.c.

196 {
197  do_flush( );
198 }
void do_flush(void)
Definition: do_loops.c:165

Here is the call graph for this function:

void fdo_l1misses ( int n)

Definition at line 219 of file do_loops.c.

220 {
221  do_l1misses( *n );
222 }
void do_l1misses(int n)
Definition: do_loops.c:213
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void FDO_L1MISSES ( int n)

Definition at line 237 of file do_loops.c.

238 {
239  do_l1misses( *n );
240 }
void do_l1misses(int n)
Definition: do_loops.c:213
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_l1misses_ ( int n)

Definition at line 225 of file do_loops.c.

226 {
227  do_l1misses( *n );
228 }
void do_l1misses(int n)
Definition: do_loops.c:213
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_l1misses__ ( int n)

Definition at line 231 of file do_loops.c.

232 {
233  do_l1misses( *n );
234 }
void do_l1misses(int n)
Definition: do_loops.c:213
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_misses ( int n,
int size 
)

Definition at line 135 of file do_loops.c.

136 {
137  do_misses( *n, *size );
138 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:113
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void FDO_MISSES ( int n,
int size 
)

Definition at line 153 of file do_loops.c.

154 {
155  do_misses( *n, *size );
156 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:113
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_misses_ ( int n,
int size 
)

Definition at line 141 of file do_loops.c.

142 {
143  do_misses( *n, *size );
144 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:113
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_misses__ ( int n,
int size 
)

Definition at line 147 of file do_loops.c.

148 {
149  do_misses( *n, *size );
150 }
char *long long size
Definition: iozone.c:12023
void do_misses(int n, int bytes)
Definition: do_loops.c:113
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_reads ( int n)

Definition at line 41 of file do_loops.c.

42 {
43  do_reads( *n );
44 }
void do_reads(int n)
Definition: do_loops.c:12
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void FDO_READS ( int n)

Definition at line 59 of file do_loops.c.

60 {
61  do_reads( *n );
62 }
void do_reads(int n)
Definition: do_loops.c:12
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_reads_ ( int n)

Definition at line 47 of file do_loops.c.

48 {
49  do_reads( *n );
50 }
void do_reads(int n)
Definition: do_loops.c:12
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

void fdo_reads__ ( int n)

Definition at line 53 of file do_loops.c.

54 {
55  do_reads( *n );
56 }
void do_reads(int n)
Definition: do_loops.c:12
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

Variable Documentation

volatile double a = 0.5

Definition at line 9 of file do_loops.c.

volatile double b = 2.2

Definition at line 9 of file do_loops.c.

Definition at line 5 of file do_loops.c.

volatile int buf_dummy = 0

Definition at line 6 of file do_loops.c.

volatile int* flush = NULL

Definition at line 7 of file do_loops.c.

volatile int flush_dummy = 0

Definition at line 8 of file do_loops.c.