Sat, 04 May 2024 15:18:02 +0200
Log pid of each started thread so we can see which uses the most cpu time.
thermferm/devices.c | file | annotate | diff | comparison | revisions | |
thermferm/one-wire.c | file | annotate | diff | comparison | revisions | |
thermferm/panel.c | file | annotate | diff | comparison | revisions | |
thermferm/server.c | file | annotate | diff | comparison | revisions | |
thermferm/simulator.c | file | annotate | diff | comparison | revisions | |
thermferm/thermferm.h | file | annotate | diff | comparison | revisions | |
thermferm/websocket.c | file | annotate | diff | comparison | revisions |
--- a/thermferm/devices.c Sat May 04 13:49:36 2024 +0200 +++ b/thermferm/devices.c Sat May 04 15:18:02 2024 +0200 @@ -851,9 +851,10 @@ int found; time_t now; bool changed; + pid_t pid = gettid(); my_devices_state = 1; - syslog(LOG_NOTICE, "Thread my_devices_loop started"); + syslog(LOG_NOTICE, "Thread my_devices_loop started, pid=%d", pid); dht11_next = time(NULL); /*
--- a/thermferm/one-wire.c Sat May 04 13:49:36 2024 +0200 +++ b/thermferm/one-wire.c Sat May 04 15:18:02 2024 +0200 @@ -97,8 +97,10 @@ void *my_one_wire_loop(void *threadid) { + pid_t pid = gettid(); + my_one_wire_state = 1; - syslog(LOG_NOTICE, "Thread my_one_wire_loop started"); + syslog(LOG_NOTICE, "Thread my_one_wire_loop started, pid=%d", pid); /* * Run the state machine @@ -391,7 +393,8 @@ if (cur_w1->value != value) { cur_w1->timestamp = time(NULL); changed = true; - syslog(LOG_NOTICE, "One-wire device %s temperature read %d => %d", cur_w1->address, cur_w1->value, value); + if (debug) + syslog(LOG_NOTICE, "One-wire device %s temperature read %d => %d", cur_w1->address, cur_w1->value, value); } cur_w1->value = value; /* devices.c will pick this up */ } else {
--- a/thermferm/panel.c Sat May 04 13:49:36 2024 +0200 +++ b/thermferm/panel.c Sat May 04 15:18:02 2024 +0200 @@ -107,6 +107,7 @@ { int Enter = 0, Up = 0, Down = 0, Backlight = LCD_SLEEP, AnyKey = FALSE; time_t Last = (time_t)0, Now; + pid_t pid = gettid(); my_panel_state = 1; @@ -117,7 +118,7 @@ pinMode(PANEL_DOWN, INPUT); #endif - syslog(LOG_NOTICE, "Thread my_panel_loop started"); + syslog(LOG_NOTICE, "Thread my_panel_loop started, pid=%d", pid); /* * Loop forever until the external shutdown variable is set.
--- a/thermferm/server.c Sat May 04 13:49:36 2024 +0200 +++ b/thermferm/server.c Sat May 04 15:18:02 2024 +0200 @@ -2638,9 +2638,10 @@ { socklen_t addrlen; int s, optval = 1; + pid_t pid = gettid(); my_server_state = 1; - syslog(LOG_NOTICE, "Thread my_server_loop started"); + syslog(LOG_NOTICE, "Thread my_server_loop started, pid=%d", pid); /* * Prepare thread to stop in blocking accept() call.
--- a/thermferm/simulator.c Sat May 04 13:49:36 2024 +0200 +++ b/thermferm/simulator.c Sat May 04 15:18:02 2024 +0200 @@ -212,8 +212,10 @@ void *my_simulator_loop(void *threadid) { + pid_t pid = gettid(); + my_simulator_command = THREAD_RUN; - syslog(LOG_NOTICE, "Thread my_simulator_loop started"); + syslog(LOG_NOTICE, "Thread my_simulator_loop started, pid=%d", pid); /* * Run the state machine
--- a/thermferm/thermferm.h Sat May 04 13:49:36 2024 +0200 +++ b/thermferm/thermferm.h Sat May 04 15:18:02 2024 +0200 @@ -5,6 +5,8 @@ #define TRUE 1 #define FALSE 0 +#define _GNU_SOURCE + #include "../config.h" #include "pid.h"
--- a/thermferm/websocket.c Sat May 04 13:49:36 2024 +0200 +++ b/thermferm/websocket.c Sat May 04 15:18:02 2024 +0200 @@ -446,6 +446,7 @@ { struct lws_context_creation_info info; int n = 0; + pid_t pid = gettid(); my_ws_state = 1; memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */ @@ -463,7 +464,7 @@ my_ws_state = 0; return (void *)1; } - syslog(LOG_NOTICE, "Websocket: server started port %d", info.port); + syslog(LOG_NOTICE, "Websocket: server started port %d, pid=%d", info.port, pid); /* * Loop forever until external shutdown variable is set.