PAPI  5.6.0.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 17 of file dmem_info.c.

Function Documentation

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

Definition at line 19 of file dmem_info.c.

20 {
21  fprintf( output, "\n--------\n" );
22  fprintf( output, "Mem Size:\t\t%lld\n", d->size );
23  fprintf( output, "Mem Peak Size:\t\t%lld\n", d->peak );
24  fprintf( output, "Mem Resident:\t\t%lld\n", d->resident );
25  fprintf( output, "Mem High Water Mark:\t%lld\n", d->high_water_mark );
26  fprintf( output, "Mem Shared:\t\t%lld\n", d->shared );
27  fprintf( output, "Mem Text:\t\t%lld\n", d->text );
28  fprintf( output, "Mem Library:\t\t%lld\n", d->library );
29  fprintf( output, "Mem Heap:\t\t%lld\n", d->heap );
30  fprintf( output, "Mem Locked:\t\t%lld\n", d->locked );
31  fprintf( output, "Mem Stack:\t\t%lld\n", d->stack );
32  fprintf( output, "Mem Pagesize:\t\t%lld\n", d->pagesize );
33  fprintf( output, "Mem Page Table Entries:\t\t%lld\n", d->pte );
34  fprintf( output, "--------\n\n" );
35 }
long long peak
Definition: papi.h:872
long long heap
Definition: papi.h:879
long long resident
Definition: papi.h:874
long long pagesize
Definition: papi.h:882
long long locked
Definition: papi.h:880
long long library
Definition: papi.h:878
long long shared
Definition: papi.h:876
long long pte
Definition: papi.h:883
long long text
Definition: papi.h:877
long long stack
Definition: papi.h:881
long long size
Definition: papi.h:873
long long high_water_mark
Definition: papi.h:875

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 38 of file dmem_info.c.

39 {
40  PAPI_dmem_info_t dmem;
41  long long value[7];
42  int retval, i = 0, j = 0;
43  double *m[7];
44 
45  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
47  if ( retval != PAPI_VER_CURRENT )
48  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
49 
50  for ( i = 0; i < 7; i++ ) {
51  retval = PAPI_get_dmem_info( &dmem );
52  if ( retval != PAPI_OK )
53  test_fail( __FILE__, __LINE__, "PAPI_get_dmem_info", retval );
54 /* dump_memory_info(stdout,&dmem); */
55  value[i] = dmem.size;
56  m[i] = ( double * ) malloc( ALLOCMEM * sizeof ( double ) );
57  touch_dummy( m[j], ALLOCMEM );
58  }
59 
60  if ( !TESTS_QUIET ) {
61  printf( "Test case: Dynamic Memory Information.\n" );
62  dump_memory_info( stdout, &dmem );
63  printf
64  ( "------------------------------------------------------------------------\n" );
65  for ( i = 0; i < 7; i++ )
66  printf( "Malloc additional: %d KB Memory Size in KB: %d\n",
67  ( int ) ( ( sizeof ( double ) * ALLOCMEM ) / 1024 ),
68  ( int ) value[i] );
69  printf
70  ( "------------------------------------------------------------------------\n" );
71  }
72  if ( value[6] >= value[5] && value[5] >= value[4] && value[4] >= value[3]
73  && value[3] >= value[2] && value[2] >= value[1] &&
74  value[1] >= value[0] )
75  test_pass( __FILE__ );
76  else
77  test_fail( __FILE__, __LINE__, "Calculating Resident Memory",
78  ( int ) value[6] );
79 
80  return 1;
81 }
void test_pass(const char *filename)
Definition: test_utils.c:432
static void dump_memory_info(FILE *output, PAPI_dmem_info_t *d)
Definition: dmem_info.c:19
return PAPI_OK
Definition: linux-nvml.c:497
void double value
Definition: iozone.c:18781
int int argc
Definition: iozone.c:1609
void touch_dummy(double *array, int size)
Definition: do_loops.c:343
char ** argv
Definition: iozone.c:1610
int PAPI_library_init(int version)
Definition: papi.c:500
int i
Definition: fileop.c:140
A pointer to the following is passed to PAPI_get_dmem_info()
Definition: papi.h:871
#define ALLOCMEM
Definition: dmem_info.c:17
int PAPI_get_dmem_info(PAPI_dmem_info_t *dest)
Definition: papi.c:6063
printf("\tTry: -i 0 -i 1 \n\n")
int TESTS_QUIET
Definition: test_utils.c:18
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:468
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:225
long long size
Definition: papi.h:873
char * m
Definition: iozone.c:1620

Here is the call graph for this function: