diff --git a/ChangeLog b/ChangeLog index f3cdb1d..accfc55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2021-03-07: +- fixed: high cpu load, sleep function was not working right. If the current + loop took below 1ms we would ot wait for the 25ms to finish. + 2021-02-10: - automatic mode with random destinations is working now diff --git a/server/Makefile b/server/Makefile index c673d37..788f7df 100644 --- a/server/Makefile +++ b/server/Makefile @@ -9,9 +9,9 @@ ETCPREFIX=/etc DISTNAME=modelbahn CXX=g++ -CXXFLAGS= -ggdb -fPIC -Wno-write-strings -g -ggdb -std=c++11 -LDFLAGS= -lm -lc -lpthread -L/usr/local/lib -g -ggdb -LDFLAGS_CGI= -lm -lc -lpthread -L/usr/local/lib -g -ggdb +CXXFLAGS= -ggdb -fPIC -Wno-write-strings -g -ggdb -std=c++11 -pg +LDFLAGS= -lm -lc -lpthread -L/usr/local/lib -g -ggdb -pg +LDFLAGS_CGI= -lm -lc -lpthread -L/usr/local/lib -g -ggdb -pg DEPENDFILE=.depend TARGET=modelbahn-server @@ -25,10 +25,10 @@ CURDIR=`pwd` all: dep $(TARGET) test-json modelbahn-cgi modelbahn-server: $(SERVEROBJ) - $(CXX) -o $@ $^ $(LDFLAGS_CGI) -lUDPTCPNetwork -L./ -I./ -lpthread + $(CXX) -o $@ $^ $(LDFLAGS) -lUDPTCPNetwork -L./ -I./ -lpthread modelbahn-cgi: modelbahn-cgi.o debug.o - $(CXX) -o $@ $^ $(LDFLAGS) -lUDPTCPNetwork -L./ -I./ -lpthread + $(CXX) -o $@ $^ $(LDFLAGS_CGI) -lUDPTCPNetwork -L./ -I./ -lpthread test-json: json.o test-json.o debug.o $(CXX) -o $@ $^ $(LDFLAGS) -L./ -I./ -lpthread diff --git a/server/main.cc b/server/main.cc index 2014261..1015228 100644 --- a/server/main.cc +++ b/server/main.cc @@ -37,6 +37,10 @@ int main (int argc, char **argv) { fprintf (stderr, "%s:%d could not set signal for SIGHUB\n", __FILE__, __LINE__); return 0; } + if (signal(SIGUSR1, sig_int) == SIG_ERR) { + fprintf (stderr, "%s:%d could not set signal for SIGHUB\n", __FILE__, __LINE__); + return 0; + } debug (0, "***************************************************"); @@ -46,7 +50,6 @@ int main (int argc, char **argv) { debug (0, "***************************************************"); debug (0, ""); - ////////////////////////////////////////////////////////////////////// // // application startup @@ -80,7 +83,6 @@ int main (int argc, char **argv) { delete server; debug (0, "* deleted server"); debug (0, "* application exited"); - return 0; }; diff --git a/server/server.cc b/server/server.cc index 4643541..87a9ba3 100644 --- a/server/server.cc +++ b/server/server.cc @@ -117,12 +117,12 @@ void Server::ThreadProcess() { // // mode manual else if (mode == SMODE_MANUAL) { - server->locomotives.Loop(); } // // mode auto else if (mode == SMODE_AUTO) { + server->locomotives.Loop(); } gettimeofday (&tv, NULL); diff --git a/webinterface/gui/gui.css b/webinterface/gui/gui.css index e3be78b..dd53169 100644 --- a/webinterface/gui/gui.css +++ b/webinterface/gui/gui.css @@ -84,6 +84,7 @@ ul.GUIcontextmenuElements { button { + padding: 6px 6px 6px 6px; background-color: var(--input-bg-color); color: var(--input-fg-color); } diff --git a/webinterface/index.html b/webinterface/index.html index 22ab410..4068381 100644 --- a/webinterface/index.html +++ b/webinterface/index.html @@ -1,4 +1,5 @@ +