|
Lines 37-42
Link Here
|
| 37 |
|
37 |
|
| 38 |
static size_t Total = 0; |
38 |
static size_t Total = 0; |
| 39 |
static size_t MFree = 0; |
39 |
static size_t MFree = 0; |
|
|
40 |
static size_t Used = 0; |
| 41 |
static size_t Application = 0; |
| 40 |
static size_t Active = 0; |
42 |
static size_t Active = 0; |
| 41 |
static size_t InActive = 0; |
43 |
static size_t InActive = 0; |
| 42 |
static size_t STotal = 0; |
44 |
static size_t STotal = 0; |
|
Lines 71-76
initMemory(struct SensorModul* sm)
Link Here
|
| 71 |
registerMonitor("mem/physical/free", "integer", printMFree, printMFreeInfo, sm); |
73 |
registerMonitor("mem/physical/free", "integer", printMFree, printMFreeInfo, sm); |
| 72 |
registerMonitor("mem/physical/active", "integer", printActive, printActiveInfo, sm); |
74 |
registerMonitor("mem/physical/active", "integer", printActive, printActiveInfo, sm); |
| 73 |
registerMonitor("mem/physical/inactive", "integer", printInActive, printInActiveInfo, sm); |
75 |
registerMonitor("mem/physical/inactive", "integer", printInActive, printInActiveInfo, sm); |
|
|
76 |
registerMonitor("mem/physical/used", "integer", printUsed, printUsedInfo, sm); |
| 77 |
registerMonitor("mem/physical/application", "integer", printApplication, printApplicationInfo, sm); |
| 74 |
registerMonitor("mem/swap/free", "integer", printSwapFree, printSwapFreeInfo, sm); |
78 |
registerMonitor("mem/swap/free", "integer", printSwapFree, printSwapFreeInfo, sm); |
| 75 |
registerMonitor("mem/swap/used", "integer", printSwapUsed, printSwapUsedInfo, sm); |
79 |
registerMonitor("mem/swap/used", "integer", printSwapUsed, printSwapUsedInfo, sm); |
| 76 |
} |
80 |
} |
|
Lines 99-104
updateMemory(void)
Link Here
|
| 99 |
InActive /= 1024; |
103 |
InActive /= 1024; |
| 100 |
InActive -= Active; |
104 |
InActive -= Active; |
| 101 |
|
105 |
|
|
|
106 |
Used = Total - MFree; |
| 107 |
Application = Used; |
| 108 |
|
| 102 |
swapmode(&SUsed, &STotal); |
109 |
swapmode(&SUsed, &STotal); |
| 103 |
SFree = STotal - SUsed; |
110 |
SFree = STotal - SUsed; |
| 104 |
return 0; |
111 |
return 0; |
|
Lines 114-119
void
Link Here
|
| 114 |
printMFreeInfo(const char* cmd) |
121 |
printMFreeInfo(const char* cmd) |
| 115 |
{ |
122 |
{ |
| 116 |
fprintf(CurrentClient, "Free Memory\t0\t%d\tKB\n", Total); |
123 |
fprintf(CurrentClient, "Free Memory\t0\t%d\tKB\n", Total); |
|
|
124 |
} |
| 125 |
|
| 126 |
void |
| 127 |
printUsed(const char* cmd) |
| 128 |
{ |
| 129 |
fprintf(CurrentClient, "%d\n", Used); |
| 130 |
} |
| 131 |
|
| 132 |
void |
| 133 |
printUsedInfo(const char* cmd) |
| 134 |
{ |
| 135 |
fprintf(CurrentClient, "Used Memory\t0\t%d\tKB\n", Total); |
| 136 |
} |
| 137 |
|
| 138 |
void |
| 139 |
printApplication(const char* cmd) |
| 140 |
{ |
| 141 |
fprintf(CurrentClient, "%d\n", Application); |
| 142 |
} |
| 143 |
|
| 144 |
void |
| 145 |
printApplicationInfo(const char* cmd) |
| 146 |
{ |
| 147 |
fprintf(CurrentClient, "Application Memory\t0\t%ld\tKB\n", Total); |
| 117 |
} |
148 |
} |
| 118 |
|
149 |
|
| 119 |
void |
150 |
void |