PAPI  5.0.1.0
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 [16 *1024 *1024]
volatile int buf_dummy = 0
volatile int * flush = 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 294 of file do_loops.c.

{
    do_stuff(  );
}

Here is the call graph for this function:

void _FDO_FLOPS ( int *  n)

Definition at line 107 of file do_loops.c.

{
    do_flops( *n );
}

Here is the call graph for this function:

void _FDO_FLUSH ( void  )

Definition at line 208 of file do_loops.c.

{
    do_flush(  );
}

Here is the call graph for this function:

void _FDO_L1MISSES ( int *  n)

Definition at line 244 of file do_loops.c.

{
    do_l1misses( *n );
}

Here is the call graph for this function:

void _FDO_MISSES ( int *  n,
int *  size 
)

Definition at line 160 of file do_loops.c.

{
    do_misses( *n, *size );
}

Here is the call graph for this function:

void _FDO_READS ( int *  n)

Definition at line 65 of file do_loops.c.

{
    do_reads( *n );
}

Here is the call graph for this function:

void do_flops ( int  n)

Definition at line 71 of file do_loops.c.

{
    int i;
    double c = 0.11;

    for ( i = 0; i < n; i++ ) {
        c += a * b;
    }
    dummy( ( void * ) &c );
}

Here is the call graph for this function:

void do_flush ( void  )

Definition at line 166 of file do_loops.c.

{
    register int i;
    if ( flush == NULL )
        flush = ( int * ) malloc( ( 1024 * 1024 * 16 ) * sizeof ( int ) );
    if ( !flush )
        return;

    dummy( ( void * ) flush );
    for ( i = 0; i < ( 1024 * 1024 * 16 ); i++ ) {
        flush[i] += flush_dummy;
    }
    flush_dummy++;
    dummy( ( void * ) flush );
    dummy( ( void * ) &flush_dummy );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_l1misses ( int  n)

Definition at line 214 of file do_loops.c.

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.

{
    register int i, j, tmp = buf_dummy, len = bytes / ( int ) sizeof ( int );
    dummy( ( void * ) buf );
    dummy( ( void * ) &buf_dummy );
    assert( len <= CACHE_FLUSH_BUFFER_SIZE_INTS );
    n = n / 2;
    for ( j = 0; j < n; j++ ) {
        for ( i = 0; i < len; i++ ) {
            /* We need to read, modify, write here to look
               out for the write allocate policies. */
            buf[i] += tmp;
            /* Fake out some naive prefetchers */
            buf[len - 1 - i] -= tmp;
        }
        tmp += len;
    }
    buf_dummy = tmp;
    dummy( ( void * ) buf );
    dummy( ( void * ) &buf_dummy );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_reads ( int  n)

Definition at line 12 of file do_loops.c.

{
    int i, retval;
    static int fd = -1;
    char buf;

    if ( fd == -1 ) {
        fd = open( "/dev/zero", O_RDONLY );
        if ( fd == -1 ) {
            perror( "open(/dev/zero)" );
            exit( 1 );
        }
    }

    for ( i = 0; i < n; i++ ) {
        retval = ( int ) read( fd, &buf, sizeof ( buf ) );
        if ( retval != sizeof ( buf ) ) {
            if ( retval < 0 )
                perror( "/dev/zero cannot be read" );
            else
                fprintf( stderr,
                         "/dev/zero cannot be read: only got %d bytes.\n",
                         retval );
            exit( 1 );
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_stuff ( void  )

Definition at line 250 of file do_loops.c.

{
    static int loops = 0;

    if ( loops == 0 ) {
        struct timeval now, then;
        gettimeofday( &then, NULL );
        do {
            do_flops( NUM_FLOPS );
            do_reads( NUM_READS );
            do_misses( 1, 1024 * 1024 );
            gettimeofday( &now, NULL );
            loops++;
        } while ( now.tv_sec - then.tv_sec < NUM_WORK_SECONDS );
    } else {
        int i = 0;
        do {
            do_flops( NUM_FLOPS );
            do_reads( NUM_READS );
            do_misses( 1, 1024 * 1024 );
            i++;
        } while ( i < loops );
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void DO_STUFF ( void  )

Definition at line 288 of file do_loops.c.

{
    do_stuff(  );
}

Here is the call graph for this function:

void do_stuff_ ( void  )

Definition at line 276 of file do_loops.c.

{
    do_stuff(  );
}

Here is the call graph for this function:

void do_stuff__ ( void  )

Definition at line 282 of file do_loops.c.

{
    do_stuff(  );
}

Here is the call graph for this function:

void fdo_flops ( int *  n)

Definition at line 83 of file do_loops.c.

{
    do_flops( *n );
}

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.

{
    do_flops( *n );
}

Here is the call graph for this function:

void fdo_flops_ ( int *  n)

Definition at line 89 of file do_loops.c.

{
    do_flops( *n );
}

Here is the call graph for this function:

void fdo_flops__ ( int *  n)

Definition at line 95 of file do_loops.c.

{
    do_flops( *n );
}

Here is the call graph for this function:

void fdo_flush ( void  )

Definition at line 184 of file do_loops.c.

{
    do_flush(  );
}

Here is the call graph for this function:

void FDO_FLUSH ( void  )

Definition at line 202 of file do_loops.c.

{
    do_flush(  );
}

Here is the call graph for this function:

void fdo_flush_ ( void  )

Definition at line 190 of file do_loops.c.

{
    do_flush(  );
}

Here is the call graph for this function:

void fdo_flush__ ( void  )

Definition at line 196 of file do_loops.c.

{
    do_flush(  );
}

Here is the call graph for this function:

void fdo_l1misses ( int *  n)

Definition at line 220 of file do_loops.c.

{
    do_l1misses( *n );
}

Here is the call graph for this function:

void FDO_L1MISSES ( int *  n)

Definition at line 238 of file do_loops.c.

{
    do_l1misses( *n );
}

Here is the call graph for this function:

void fdo_l1misses_ ( int *  n)

Definition at line 226 of file do_loops.c.

{
    do_l1misses( *n );
}

Here is the call graph for this function:

void fdo_l1misses__ ( int *  n)

Definition at line 232 of file do_loops.c.

{
    do_l1misses( *n );
}

Here is the call graph for this function:

void fdo_misses ( int *  n,
int *  size 
)

Definition at line 136 of file do_loops.c.

{
    do_misses( *n, *size );
}

Here is the call graph for this function:

void FDO_MISSES ( int *  n,
int *  size 
)

Definition at line 154 of file do_loops.c.

{
    do_misses( *n, *size );
}

Here is the call graph for this function:

void fdo_misses_ ( int *  n,
int *  size 
)

Definition at line 142 of file do_loops.c.

{
    do_misses( *n, *size );
}

Here is the call graph for this function:

void fdo_misses__ ( int *  n,
int *  size 
)

Definition at line 148 of file do_loops.c.

{
    do_misses( *n, *size );
}

Here is the call graph for this function:

void fdo_reads ( int *  n)

Definition at line 41 of file do_loops.c.

{
    do_reads( *n );
}

Here is the call graph for this function:

void FDO_READS ( int *  n)

Definition at line 59 of file do_loops.c.

{
    do_reads( *n );
}

Here is the call graph for this function:

void fdo_reads_ ( int *  n)

Definition at line 47 of file do_loops.c.

{
    do_reads( *n );
}

Here is the call graph for this function:

void fdo_reads__ ( int *  n)

Definition at line 53 of file do_loops.c.

{
    do_reads( *n );
}

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.

volatile int buf[16 *1024 *1024]

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.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines