mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: skip formatting request timings that won't be logged
timeRequest built both 112-byte descriptions (with a String copy of the URL) on async_tcp for every request, and logElapsed threw them away for anything under 100ms. Check worthLogging() first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9988a2bec8
commit
6a3769406f
4 changed files with 28 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include <unity.h>
|
||||
#include "LogLockPolicy.h"
|
||||
#include "Timing.h"
|
||||
|
||||
void setUp() {}
|
||||
void tearDown() {}
|
||||
|
|
@ -25,6 +26,20 @@ static void test_logLock_no_wait_allowed() {
|
|||
TEST_ASSERT_FALSE(keepWaitingForLogLock(LogHolder::running, 0, 0));
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* worthLogging
|
||||
********************************************************************/
|
||||
static void test_worthLogging_fast_timings_are_skipped() {
|
||||
TEST_ASSERT_FALSE(worthLogging(0));
|
||||
TEST_ASSERT_FALSE(worthLogging(999));
|
||||
TEST_ASSERT_FALSE(worthLogging(TIMING_LOG_MIN_MS * 1000 - 1));
|
||||
}
|
||||
static void test_worthLogging_from_the_threshold() {
|
||||
TEST_ASSERT_TRUE(worthLogging(TIMING_LOG_MIN_MS * 1000));
|
||||
TEST_ASSERT_TRUE(worthLogging(TIMING_SLOW_MS * 1000));
|
||||
TEST_ASSERT_TRUE(worthLogging(UINT32_MAX));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
|
@ -34,5 +49,7 @@ int main(int argc, char **argv) {
|
|||
RUN_TEST(test_logLock_waits_for_a_holder_preempted_here);
|
||||
RUN_TEST(test_logLock_gives_up_on_a_holder_preempted_elsewhere);
|
||||
RUN_TEST(test_logLock_no_wait_allowed);
|
||||
RUN_TEST(test_worthLogging_fast_timings_are_skipped);
|
||||
RUN_TEST(test_worthLogging_from_the_threshold);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue