dmem_info.c File Reference

Include dependency graph for dmem_info.c:

Go to the source code of this file.

Defines

#define ALLOCMEM   200000

Functions

static void dump_memory_info (FILE *output, PAPI_dmem_info_t *d)
int main (int argc, char **argv)

Define Documentation

#define ALLOCMEM   200000

Definition at line 10 of file dmem_info.c.


Function Documentation

static void dump_memory_info ( FILE *  output,
PAPI_dmem_info_t d 
) [static]

Definition at line 12 of file dmem_info.c.

00013 {
00014     fprintf( output, "\n--------\n" );
00015     fprintf( output, "Mem Size:\t\t%lld\n", d->size );
00016     fprintf( output, "Mem Peak Size:\t\t%lld\n", d->peak );
00017     fprintf( output, "Mem Resident:\t\t%lld\n", d->resident );
00018     fprintf( output, "Mem High Water Mark:\t%lld\n", d->high_water_mark );
00019     fprintf( output, "Mem Shared:\t\t%lld\n", d->shared );
00020     fprintf( output, "Mem Text:\t\t%lld\n", d->text );
00021     fprintf( output, "Mem Library:\t\t%lld\n", d->library );
00022     fprintf( output, "Mem Heap:\t\t%lld\n", d->heap );
00023     fprintf( output, "Mem Locked:\t\t%lld\n", d->locked );
00024     fprintf( output, "Mem Stack:\t\t%lld\n", d->stack );
00025     fprintf( output, "Mem Pagesize:\t\t%lld\n", d->pagesize );
00026     fprintf( output, "Mem Page Table Entries:\t\t%lld\n", d->pte );
00027     fprintf( output, "--------\n\n" );
00028 }

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 31 of file dmem_info.c.

00032 {
00033     PAPI_dmem_info_t dmem;
00034     long long value[7];
00035     int retval, i = 0, j = 0;
00036     double *m[7];
00037 
00038     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00039     retval = PAPI_library_init( PAPI_VER_CURRENT );
00040     if ( retval != PAPI_VER_CURRENT )
00041         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00042 
00043     for ( i = 0; i < 7; i++ ) {
00044         retval = PAPI_get_dmem_info( &dmem );
00045         if ( retval != PAPI_OK )
00046             test_fail( __FILE__, __LINE__, "PAPI_get_dmem_info", retval );
00047 /*     dump_memory_info(stdout,&dmem); */
00048         value[i] = dmem.size;
00049         m[i] = ( double * ) malloc( ALLOCMEM * sizeof ( double ) );
00050         touch_dummy( m[j], ALLOCMEM );
00051     }
00052 
00053     if ( !TESTS_QUIET ) {
00054         printf( "Test case:  Dynamic Memory Information.\n" );
00055         dump_memory_info( stdout, &dmem );
00056         printf
00057             ( "------------------------------------------------------------------------\n" );
00058         for ( i = 0; i < 7; i++ )
00059             printf( "Malloc additional: %d KB  Memory Size in KB: %d\n",
00060                     ( int ) ( ( sizeof ( double ) * ALLOCMEM ) / 1024 ),
00061                     ( int ) value[i] );
00062         printf
00063             ( "------------------------------------------------------------------------\n" );
00064     }
00065     if ( value[6] >= value[5] && value[5] >= value[4] && value[4] >= value[3]
00066          && value[3] >= value[2] && value[2] >= value[1] &&
00067          value[1] >= value[0] )
00068         test_pass( __FILE__, NULL, 0 );
00069     else
00070         test_fail( __FILE__, __LINE__, "Calculating Resident Memory",
00071                    ( int ) value[6] );
00072 
00073     exit( 1 );
00074 }

Here is the call graph for this function:


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1