}
@Override
public void run() {
for (AgentStatus agentStates : agentManager.getAgentStatusSetConnectingToPort(singleConsole.getConsolePort())) {
SystemDataModel systemDataModel = agentStates.getSystemDataModel();
if (systemDataModel != null) {
// If the memory is available less than 2%.
double freeMemoryRatio = ((double) systemDataModel.getFreeMemory()) / systemDataModel.getTotalMemory();
if (freeMemoryRatio < 0.02) {
if (perfTest.getStatus() != Status.ABNORMAL_TESTING) {
perfTestService.markStatusAndProgress(perfTest, Status.ABNORMAL_TESTING, //
String.format("[ERROR] %s agent is about to die due to lack of free memory.\n"
+ "Shutdown PerfTest %s by force for safety\n" + "Please decrease the vuser count.", //