1PAPI_get_dmem_info(3) PAPI PAPI_get_dmem_info(3)
2
3
4
6 PAPI_get_dmem_info - get information about the dynamic memory usage of
7 the current program
8
9
11 C Interface
12 #include <papi.h>
13 int PAPI_get_dmem_info(PAPI_dmem_info_t *dmem);
14 Fortran Interface
15 #include fpapi.h
16 PAPIF_get_dmem_info(C_LONG_LONG(*) dmem, C_INT check)
17
18
20 In C, this function takes a pointer to a PAPI_dmem_info_t structure and
21 returns with the structure fields filled in. In Fortran, this function
22 takes a pointer to an array of long_long values and fills in the array
23 on return. A value of PAPI_EINVAL in any field indicates an undefined
24 parameter.
25
26
28 This function is currently implemented only for the Linux operating
29 system.
30
31
33 dmem -- Structure (C) or array (Fortran) containing the following val‐
34 ues (Fortran values can be accessed using the specified indices):
35
36 peak [PAPIF_DMEM_VMPEAK] (Peak size of process image, may be 0 on older
37 Linux systems),
38
39 size [PAPIF_DMEM_VMSIZE] (Size of process image),
40
41 resident [PAPIF_DMEM_RESIDENT] (Resident set size),
42
43 high_water_mark [PAPIF_DMEM_HIGH_WATER] (High water memory usage),
44
45 shared [PAPIF_DMEM_SHARED] (Shared memory),
46
47 text [PAPIF_DMEM_TEXT] (Memory allocated to code),
48
49 library [PAPIF_DMEM_LIBRARY] (Memory allocated to libraries),
50
51 heap [PAPIF_DMEM_HEAP] (Size of the heap),
52
53 locked [PAPIF_DMEM_LOCKED] (Locked memory),
54
55 stack [PAPIF_DMEM_STACK] (Size of the stack)
56
57 pagesize [PAPIF_DMEM_PAGESIZE] (Size of a page in bytes),
58
59 pte [PAPIF_DMEM_PTE] (Size of page table entries, may be 0 on older
60 Linux systems)
61
62
64 On success, this function returns PAPI_OK with the data structure or
65 array values filled in. On error a negative error value is returned.
66
67
69 PAPI_ESBSTR
70 The funtion is not implemented for the current substrate.
71
72 PAPI_EINVAL
73 Any value in the structure or array may be undefined as indi‐
74 cated by this error value.
75
76 PAPI_SYS
77 A system error occured.
78
79
81 int retval;
82 PAPI_dmem_info_t dmem;
83
84 if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
85 exit(1);
86
87 retval = PAPI_library_init(PAPI_VER_CURRENT);
88 if (retval != PAPI_VER_CURRENT)
89 handle_error(retval);
90
91 PAPI_get_dmem_info(&dmem);
92 printf("Peak Mem Size:%lld0,dmem.peak);
93 printf("Mem Size:%lld0,dmem.size);
94 printf("Mem Resident:%lld0,dmem.resident);
95 printf("Peak Resident:%lld0,dmem.high_water_mark);
96 printf("Mem Shared:%lld0,dmem.shared);
97 printf("Mem Text:%lld0,dmem.text);
98 printf("Mem Library:%lld0,dmem.library);
99 printf("Mem Heap:%lld0,dmem.heap);
100 printf("Mem Locked:%lld0,dmem.locked);
101 printf("Mem Stack:%lld0,dmem.stack);
102 printf("Mem Pagesize:%lld0,dmem.pagesize);
103 printf("Mem Page Eable Entries:%lld0,dmem.pte);
104
105
107 If called before PAPI_library_init() the behavior of the routine is
108 undefined.
109
110
112 PAPI_library_init(3), PAPI_get_opt(3), PAPI_get_hardware_info(3),
113 PAPI_get_executable_info(3)
114
115
116
117PAPI Programmer's Reference May, 2006 PAPI_get_dmem_info(3)