From 854584138b5d41326624b84a5323565c524ce8d1 Mon Sep 17 00:00:00 2001 From: Proddy Date: Mon, 20 Feb 2023 18:08:41 +0100 Subject: [PATCH] update memory test --- scripts/run_memory_test.py | 9 +++++---- src/test/test.cpp | 2 +- src/test/test.h | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/run_memory_test.py b/scripts/run_memory_test.py index e7c03e307..fb826d70c 100644 --- a/scripts/run_memory_test.py +++ b/scripts/run_memory_test.py @@ -10,7 +10,7 @@ import argparse import requests import time from timeit import default_timer as timer -import platform # For getting the operating system name +import platform # For getting the operating system type import subprocess # For executing a shell command from termcolor import cprint @@ -19,17 +19,18 @@ def print_fail(x): return cprint(x, 'red') def ping_until_up(ip, text): print(text + "...", flush=True, end="") + time.sleep(1) param = '-n' if platform.system().lower()=='windows' else '-c' command = ["ping", param, "2", ip] while True: if (subprocess.run(args=command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0): print_success("Connected") + time.sleep(1) return print(".", flush=True, end="") time.sleep(1) def run_test(ip, wait, name, token): - WAIT_REBOOT = 10 BASE_URL = "http://" + str(ip) INFO_URL = BASE_URL + "/api/system/info" RESTART_URL = BASE_URL + "/api/system/restart" @@ -72,7 +73,7 @@ def run_test(ip, wait, name, token): uptime_a = response.json()['System Info']['uptime (seconds)'] freemem_a = response.json()['System Info']['free mem'] maxalloc_a = response.json()['System Info']['max alloc'] - print_success("Uptime is " + str(uptime_a) + " secs, Free mem/Max alloc is " + str(freemem_a) + "/" + str(maxalloc_a) ) + print_success("Uptime is " + str(uptime_a) + " secs, Free mem/Max alloc before=" + str(freemem_a) + "/" + str(maxalloc_a) ) end = timer() # run test @@ -97,7 +98,7 @@ def run_test(ip, wait, name, token): uptime_b = response.json()['System Info']['uptime (seconds)'] freemem_b = response.json()['System Info']['free mem'] maxalloc_b = response.json()['System Info']['max alloc'] - print_success("Uptime is " + str(uptime_b) + " secs, Free mem/Max alloc is " + str(freemem_b) + "/" + str(maxalloc_b) ) + print_success("Uptime is " + str(uptime_b) + " secs, Free mem/Max alloc after=" + str(freemem_b) + "/" + str(maxalloc_b) ) print() # check if it worked and report back diff --git a/src/test/test.cpp b/src/test/test.cpp index 568809cf1..d9b6da93b 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -36,7 +36,7 @@ bool Test::run_test(const char * command, int8_t id) { System::test_set_all_active(true); // include all entities and give them fake values // simulate HansRemmerswaal's setup - see https://github.com/emsesp/EMS-ESP32/issues/859 - add_device(0x08, 172); // 160 entities - boiler: Enviline/Compress 6000AW/Hybrid 3000-7000iAW/SupraEco/Geo 5xx/WLW196i + add_device(0x08, 172); // 176 entities - boiler: Enviline/Compress 6000AW/Hybrid 3000-7000iAW/SupraEco/Geo 5xx/WLW196i // add_device(0x10, 158); // 62 entities - thermostat: RC300/RC310/Moduline 3000/1010H/CW400/Sense II/HPC410 // add_device(0x38, 200); // 4 entities - thermostat: RC100H diff --git a/src/test/test.h b/src/test/test.h index 611f30637..6483c1057 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -30,7 +30,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "solar" // #define EMSESP_DEBUG_DEFAULT "web" // #define EMSESP_DEBUG_DEFAULT "mqtt" -#define EMSESP_DEBUG_DEFAULT "general" +// #define EMSESP_DEBUG_DEFAULT "general" // #define EMSESP_DEBUG_DEFAULT "boiler" // #define EMSESP_DEBUG_DEFAULT "mqtt2" // #define EMSESP_DEBUG_DEFAULT "mqtt_nested" @@ -52,7 +52,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "api_wwmode" // #define EMSESP_DEBUG_DEFAULT "custom" // #define EMSESP_DEBUG_DEFAULT "entity_dump" -// #define EMSESP_DEBUG_DEFAULT "memory" +#define EMSESP_DEBUG_DEFAULT "memory" class Test { public: