PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dmem_info.c File Reference
Include dependency graph for dmem_info.c:

Go to the source code of this file.

Macros

#define ALLOCMEM   200000
 

Functions

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

Macro Definition 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.

13 {
14  fprintf( output, "\n--------\n" );
15  fprintf( output, "Mem Size:\t\t%lld\n", d->size );
16  fprintf( output, "Mem Peak Size:\t\t%lld\n", d->peak );
17  fprintf( output, "Mem Resident:\t\t%lld\n", d->resident );
18  fprintf( output, "Mem High Water Mark:\t%lld\n", d->high_water_mark );
19  fprintf( output, "Mem Shared:\t\t%lld\n", d->shared );
20  fprintf( output, "Mem Text:\t\t%lld\n", d->text );
21  fprintf( output, "Mem Library:\t\t%lld\n", d->library );
22  fprintf( output, "Mem Heap:\t\t%lld\n", d->heap );
23  fprintf( output, "Mem Locked:\t\t%lld\n", d->locked );
24  fprintf( output, "Mem Stack:\t\t%lld\n", d->stack );
25  fprintf( output, "Mem Pagesize:\t\t%lld\n", d->pagesize );
26  fprintf( output, "Mem Page Table Entries:\t\t%lld\n", d->pte );
27  fprintf( output, "--------\n\n" );
28 }
long long peak
Definition: papi.h:867
long long heap
Definition: papi.h:874
long long resident
Definition: papi.h:869
long long pagesize
Definition: papi.h:877
long long locked
Definition: papi.h:875
long long library
Definition: papi.h:873
long long shared
Definition: papi.h:871
long long pte
Definition: papi.h:878
long long text
Definition: papi.h:872
long long stack
Definition: papi.h:876
long long size
Definition: papi.h:868
long long high_water_mark
Definition: papi.h:870

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 31 of file dmem_info.c.

32 {
33  PAPI_dmem_info_t dmem;
34  long long value[7];
35  int retval, i = 0, j = 0;
36  double *m[7];
37 
38  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
40  if ( retval != PAPI_VER_CURRENT )
41  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
42 
43  for ( i = 0; i < 7; i++ ) {
44  retval = PAPI_get_dmem_info( &dmem );
45  if ( retval != PAPI_OK )
46  test_fail( __FILE__, __LINE__, "PAPI_get_dmem_info", retval );
47 /* dump_memory_info(stdout,&dmem); */
48  value[i] = dmem.size;
49  m[i] = ( double * ) malloc( ALLOCMEM * sizeof ( double ) );
50  touch_dummy( m[j], ALLOCMEM );
51  }
52 
53  if ( !TESTS_QUIET ) {
54  printf( "Test case: Dynamic Memory Information.\n" );
55  dump_memory_info( stdout, &dmem );
56  printf
57  ( "------------------------------------------------------------------------\n" );
58  for ( i = 0; i < 7; i++ )
59  printf( "Malloc additional: %d KB Memory Size in KB: %d\n",
60  ( int ) ( ( sizeof ( double ) * ALLOCMEM ) / 1024 ),
61  ( int ) value[i] );
62  printf
63  ( "------------------------------------------------------------------------\n" );
64  }
65  if ( value[6] >= value[5] && value[5] >= value[4] && value[4] >= value[3]
66  && value[3] >= value[2] && value[2] >= value[1] &&
67  value[1] >= value[0] )
68  test_pass( __FILE__, NULL, 0 );
69  else
70  test_fail( __FILE__, __LINE__, "Calculating Resident Memory",
71  ( int ) value[6] );
72 
73  exit( 1 );
74 }
static void dump_memory_info(FILE *output, PAPI_dmem_info_t *d)
Definition: dmem_info.c:12
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
#define printf
Definition: papi_test.h:125
void double value
Definition: iozone.c:18781
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:495
int i
Definition: fileop.c:140
A pointer to the following is passed to PAPI_get_dmem_info()
Definition: papi.h:866
#define ALLOCMEM
Definition: dmem_info.c:10
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
void touch_dummy(double *array, int size)
Definition: dummy.c:41
int PAPI_get_dmem_info(PAPI_dmem_info_t *dest)
Definition: papi.c:5937
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
long long size
Definition: papi.h:868
void exit()
char * m
Definition: iozone.c:1620

Here is the call graph for this function: