Skip to content

Commit 8ad628e

Browse files
jBarzmattcolegate
authored andcommitted
add logging and calculate private memory on z/OS
1 parent b2d700c commit 8ad628e

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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)

src/plugins/node/memory/nodezmemoryplugin.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
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+
3745
namespace plugin {
3846
agentCoreFunctions api;
3947
uint32 provid = 0;
@@ -122,13 +130,25 @@ static int64 getTotalPhysicalMemorySize() {
122130

123131
static 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

129142
static 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

134154
static int64 getProcessVirtualMemorySize() {

0 commit comments

Comments
 (0)