| 144 | } |
| 145 | |
| 146 | static int printOutput(printInfoStruct& printInfo) |
| 147 | { |
| 148 | if (l_Debug) |
| 149 | std::wcout << L"Constructing output string" << '\n'; |
| 150 | |
| 151 | state state = OK; |
| 152 | |
| 153 | std::wcout << L"MEMORY "; |
| 154 | |
| 155 | double currentValue; |
| 156 | |
| 157 | if (!printInfo.showUsed) |
| 158 | currentValue = printInfo.aRam; |
| 159 | else |
| 160 | currentValue = printInfo.tRam - printInfo.aRam; |
| 161 | |
| 162 | if (printInfo.warn.rend(currentValue, printInfo.tRam)) |
| 163 | state = WARNING; |
| 164 | |
| 165 | if (printInfo.crit.rend(currentValue, printInfo.tRam)) |
| 166 | state = CRITICAL; |
| 167 | |
| 168 | std::wcout << stateToString(state); |
| 169 | |
| 170 | if (!printInfo.showUsed) |
| 171 | std::wcout << " - " << printInfo.percentFree << L"% free"; |
| 172 | else |
| 173 | std::wcout << " - " << 100 - printInfo.percentFree << L"% used"; |
| 174 | |
| 175 | std::wcout << "| 'memory'=" << currentValue << BunitStr(printInfo.unit) << L";" |
| 176 | << printInfo.warn.pString(printInfo.tRam) << L";" << printInfo.crit.pString(printInfo.tRam) |
| 177 | << L";0;" << printInfo.tRam << '\n'; |
| 178 | |
| 179 | return state; |
| 180 | } |
| 181 | |
| 182 | static int check_memory(printInfoStruct& printInfo) |
| 183 | { |
no test coverage detected