perf(influx): batch measurements and reuse HTTP connections

This commit is contained in:
root
2026-11-11 22:57:12 +00:00
parent dde4736cc2
commit e88623cf6e
11 changed files with 782 additions and 325 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
"""Compile the real Influx worker against a deterministic FreeRTOS/HTTP simulator."""
from pathlib import Path
import subprocess
import tempfile
firmware = Path(__file__).resolve().parents[2]
tests = Path(__file__).resolve().parent
source = firmware / 'components/net_influx'
with tempfile.TemporaryDirectory(prefix='nanopsx-influx-test-') as directory:
build = Path(directory)
for header in ['esp_err.h', 'esp_log.h', 'esp_timer.h', 'esp_http_client.h',
'storage.h', 'sys_status.h', 'freertos/FreeRTOS.h',
'freertos/task.h', 'freertos/queue.h', 'freertos/semphr.h']:
path = build / header
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text('#include "fake_sdk.h"\n')
program = build / 'test_runtime'
subprocess.run(['cc', '-std=c11', '-D_POSIX_C_SOURCE=200809L', '-Wall', '-Wextra',
'-Wno-sign-compare', '-g', '-fsanitize=address,undefined',
'-fno-omit-frame-pointer', '-fno-pie', '-no-pie',
'-I', str(build), '-I', str(tests), '-I', str(source / 'include'),
'-I', str(source / 'src'), str(tests / 'test_runtime.c'),
str(source / 'src/influx_batch.c'), '-lm', '-o', str(program)], check=True)
for scenario in ['format', 'clock', 'normal', 'retry', 'overflow', 'no-date',
'no-date-failure', 'partial', 'max-body', 'reject']:
subprocess.run([str(program), scenario], check=True)