ipc.c File Reference

Include dependency graph for ipc.c:

Go to the source code of this file.

Defines

#define INDEX   500

Functions

int main (int argc, char **argv)

Variables

int TESTS_QUIET

Define Documentation

#define INDEX   500

Definition at line 9 of file ipc.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file ipc.c.

00015 {
00016     extern void dummy( void * );
00017     float matrixa[INDEX][INDEX], matrixb[INDEX][INDEX], mresult[INDEX][INDEX];
00018     float real_time, proc_time, ipc;
00019     long long ins;
00020     int retval;
00021     int i, j, k;
00022 
00023     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00024 
00025 
00026     /* Initialize the Matrix arrays */
00027     for( i = 0; i < INDEX; i++ ) {
00028        for( j= 0; j < INDEX; j++ ) {
00029            mresult[i][j] = 0.0;
00030            matrixa[i][j] = matrixb[i][j] = ( float ) rand(  ) * ( float ) 1.1;
00031        }
00032     }
00033 
00034     /* Setup PAPI library and begin collecting data from the counters */
00035     if ( ( retval = PAPI_ipc( &real_time, &proc_time, &ins, &ipc ) ) < PAPI_OK )
00036         test_fail( __FILE__, __LINE__, "PAPI_ipc", retval );
00037 
00038     /* Matrix-Matrix multiply */
00039     for ( i = 0; i < INDEX; i++ )
00040         for ( j = 0; j < INDEX; j++ )
00041             for ( k = 0; k < INDEX; k++ )
00042                 mresult[i][j] = mresult[i][j] + matrixa[i][k] * matrixb[k][j];
00043 
00044     /* Collect the data into the variables passed in */
00045     if ( ( retval = PAPI_ipc( &real_time, &proc_time, &ins, &ipc ) ) < PAPI_OK )
00046         test_fail( __FILE__, __LINE__, "PAPI_ipc", retval );
00047     dummy( ( void * ) mresult );
00048 
00049     if ( !TESTS_QUIET ) {
00050         printf( "Real_time: %f Proc_time: %f Total ins: ", real_time,
00051                 proc_time );
00052         printf( LLDFMT, ins );
00053         printf( " IPC: %f\n", ipc );
00054     }
00055    
00056            /* This should not happen unless the optimizer */
00057            /* gets too good                               */
00058         if (ins < INDEX*INDEX) {
00059        test_fail( __FILE__, __LINE__, "Instruction count too low.", 
00060               5 );
00061     }
00062            /* Something is broken, or else you have a really */
00063            /* slow processor                                 */
00064         if (ipc<0.01 ) {
00065        test_fail( __FILE__, __LINE__, "IPC equals zero.", 
00066               5 );
00067     }
00068    
00069     test_pass( __FILE__, NULL, 0 );
00070     exit( 1 );
00071 }

Here is the call graph for this function:


Variable Documentation

Definition at line 11 of file test_utils.c.


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1