File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -18,3 +18,4 @@ Authors ordered by first contribution:
1818 - Gibson Fahnestock (https://github.com/gibfahn )
1919 - ? (https://github.com/nqvst )
2020 - Vladislav Botvin (https://github.com/darky )
21+ - John Barboza (https://github.com/jbarz )
Original file line number Diff line number Diff line change 3434#define NODEZMEMPLUGIN_DECL
3535#define MEMORY_INTERVAL 2000
3636
37+ #define PSA_PTR 0x00
38+ /* Pointer to the home (current) ASCB. */
39+ #define PSAAOLD 0x224
40+ /* Pointer to lda extension. */
41+ #define ASCBLDA 0x30
42+ /* Size of user V=V private memory. */
43+ #define LDAELOAL 0xF0
44+
3745namespace plugin {
3846 agentCoreFunctions api;
3947 uint32 provid = 0 ;
@@ -122,13 +130,25 @@ static int64 getTotalPhysicalMemorySize() {
122130
123131static int64 getProcessPhysicalMemorySize () {
124132 size_t size;
125- uv_resident_set_memory (&size);
133+
134+ plugin::api.logMessage (loggingLevel::debug, " [memory_node] >>getProcessPhysicalMemorySize()" );
135+ if (uv_resident_set_memory (&size)) {
136+ plugin::api.logMessage (loggingLevel::debug, " [memory_node] error in getProcessPhysicalMemorySize()" );
137+ return -1 ;
138+ }
126139 return size;
127140}
128141
129142static int64 getProcessPrivateMemorySize () {
130- // TODO: see if we can improve this on z/OS
131- return -1 ;
143+ char * psa;
144+ char * ascb;
145+ char * lda;
146+
147+ plugin::api.logMessage (loggingLevel::debug, " [memory_node] >>getProcessPrivateMemorySize()" );
148+ psa = PSA_PTR;
149+ ascb = *(char * __ptr32 *)(psa + PSAAOLD);
150+ lda = *(char * __ptr32 *)(ascb + ASCBLDA);
151+ return *(unsigned int *)(lda + LDAELOAL);
132152}
133153
134154static int64 getProcessVirtualMemorySize () {
You can’t perform that action at this time.
0 commit comments