17#define ALLOCMEM 200000
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 );
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" );
38main(
int argc,
char **argv )
50 for (
i = 0;
i < 7;
i++ ) {
56 m[
i] = (
double * ) malloc(
ALLOCMEM *
sizeof (
double ) );
61 printf(
"Test case: Dynamic Memory Information.\n" );
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 ),
70 (
"------------------------------------------------------------------------\n" );
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] )
77 test_fail( __FILE__, __LINE__,
"Calculating Resident Memory",
Get information about the dynamic memory usage of the current program.
initialize the PAPI library.
static void dump_memory_info(FILE *output, PAPI_dmem_info_t *d)
void touch_dummy(double *array, int size)
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
A pointer to the following is passed to PAPI_get_dmem_info()
long long high_water_mark