mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
update memory test
This commit is contained in:
@@ -10,7 +10,7 @@ import argparse
|
|||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
from timeit import default_timer as timer
|
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
|
import subprocess # For executing a shell command
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
@@ -19,17 +19,18 @@ def print_fail(x): return cprint(x, 'red')
|
|||||||
|
|
||||||
def ping_until_up(ip, text):
|
def ping_until_up(ip, text):
|
||||||
print(text + "...", flush=True, end="")
|
print(text + "...", flush=True, end="")
|
||||||
|
time.sleep(1)
|
||||||
param = '-n' if platform.system().lower()=='windows' else '-c'
|
param = '-n' if platform.system().lower()=='windows' else '-c'
|
||||||
command = ["ping", param, "2", ip]
|
command = ["ping", param, "2", ip]
|
||||||
while True:
|
while True:
|
||||||
if (subprocess.run(args=command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0):
|
if (subprocess.run(args=command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0):
|
||||||
print_success("Connected")
|
print_success("Connected")
|
||||||
|
time.sleep(1)
|
||||||
return
|
return
|
||||||
print(".", flush=True, end="")
|
print(".", flush=True, end="")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
def run_test(ip, wait, name, token):
|
def run_test(ip, wait, name, token):
|
||||||
WAIT_REBOOT = 10
|
|
||||||
BASE_URL = "http://" + str(ip)
|
BASE_URL = "http://" + str(ip)
|
||||||
INFO_URL = BASE_URL + "/api/system/info"
|
INFO_URL = BASE_URL + "/api/system/info"
|
||||||
RESTART_URL = BASE_URL + "/api/system/restart"
|
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)']
|
uptime_a = response.json()['System Info']['uptime (seconds)']
|
||||||
freemem_a = response.json()['System Info']['free mem']
|
freemem_a = response.json()['System Info']['free mem']
|
||||||
maxalloc_a = response.json()['System Info']['max alloc']
|
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()
|
end = timer()
|
||||||
|
|
||||||
# run test
|
# run test
|
||||||
@@ -97,7 +98,7 @@ def run_test(ip, wait, name, token):
|
|||||||
uptime_b = response.json()['System Info']['uptime (seconds)']
|
uptime_b = response.json()['System Info']['uptime (seconds)']
|
||||||
freemem_b = response.json()['System Info']['free mem']
|
freemem_b = response.json()['System Info']['free mem']
|
||||||
maxalloc_b = response.json()['System Info']['max alloc']
|
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()
|
print()
|
||||||
|
|
||||||
# check if it worked and report back
|
# check if it worked and report back
|
||||||
|
|||||||
@@ -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
|
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
|
// 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(0x10, 158); // 62 entities - thermostat: RC300/RC310/Moduline 3000/1010H/CW400/Sense II/HPC410
|
||||||
// add_device(0x38, 200); // 4 entities - thermostat: RC100H
|
// add_device(0x38, 200); // 4 entities - thermostat: RC100H
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace emsesp {
|
|||||||
// #define EMSESP_DEBUG_DEFAULT "solar"
|
// #define EMSESP_DEBUG_DEFAULT "solar"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "web"
|
// #define EMSESP_DEBUG_DEFAULT "web"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "mqtt"
|
// #define EMSESP_DEBUG_DEFAULT "mqtt"
|
||||||
#define EMSESP_DEBUG_DEFAULT "general"
|
// #define EMSESP_DEBUG_DEFAULT "general"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "boiler"
|
// #define EMSESP_DEBUG_DEFAULT "boiler"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "mqtt2"
|
// #define EMSESP_DEBUG_DEFAULT "mqtt2"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "mqtt_nested"
|
// #define EMSESP_DEBUG_DEFAULT "mqtt_nested"
|
||||||
@@ -52,7 +52,7 @@ namespace emsesp {
|
|||||||
// #define EMSESP_DEBUG_DEFAULT "api_wwmode"
|
// #define EMSESP_DEBUG_DEFAULT "api_wwmode"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "custom"
|
// #define EMSESP_DEBUG_DEFAULT "custom"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "entity_dump"
|
// #define EMSESP_DEBUG_DEFAULT "entity_dump"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "memory"
|
#define EMSESP_DEBUG_DEFAULT "memory"
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user