Skip to content

Commit ecb378c

Browse files
New release 1.1.1:
- Fix problems with CMake - Remove the timestamp file update - Removed also the env_vars.h related to the file timestamp approach.
1 parent 816b9fa commit ecb378c

3 files changed

Lines changed: 47 additions & 35 deletions

File tree

README.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,28 @@ safe**.
2121
You can set some library functionalities on CMake:
2222

2323
- -DLOGGING_TYPE=\<logging approach to set the logging approach, that can be LOCAL, UDP, LOCAL_AND_UDP.\>
24-
- Default: LOCAL
25-
- -DWITH_PYTHON_SUPPORT=\<ON/OFF to disable Python 3.8 wrapper building\>
26-
- Default: ON
24+
- Default: LOCAL
25+
- -DWITH_PYTHON_SUPPORT=\<ON/OFF to disable Python 3 wrapper building\>
26+
- Default: ON
2727
- -DWITH_DEBUG=\<ON/OFF to disable debug printing information\>
28-
- Default: OFF
28+
- Default: OFF
2929
- -DRAD_BENCHS_INSTALL_DIR=\<path to rad benchmarks\>
30-
- Default: /home/carol/radiation-benchmarks
31-
- -DWATCHDOG_COMMANDS=\<signal command to be sent to the local SW watchdog\>
32-
- Example: -DWATCHDOG_COMMANDS="killall -q -USR1 killtestSignal-2.0.py; killall -q -USR1 test_killtest_commands_json-2.0.py;"
33-
- Default: none
34-
- -DTMP_DIR=\<System tmp dir\>
35-
- Default: /tmp
36-
- -DECC_INFO_FILE_DIR=\<Path to file that will contain 1/0 that refers to ECC
37-
enabled or disabled respectively\>
38-
- Default: /tmp/ecc-info-file.txt
30+
- Default: /home/carol/radiation-benchmarks
31+
- -DWATCHDOG_COMMANDS=\<signal command to be sent to the local software watchdog\>
32+
- Example: -DWATCHDOG_COMMANDS="killall -q -USR1 watchdog1.py; killall -q -USR1 watchdog2.py;"
33+
- Default: none
34+
- -DTMP_DIR=\<System tmp dir\>
35+
- Default: /tmp
36+
- -DECC_INFO_FILE_DIR=\<Path to file that will contain 1/0 that refers to ECC
37+
enabled or disabled respectively\>
38+
- Default: /tmp/ecc-info-file.txt
3939
- -DSERVER_IP=\<Server that will receive the messages IP\>
40-
- Default: 192.168.1.5
40+
- Default: 192.168.1.5
4141
- -DSERVER_PORT=\<server port that will receive the messages\>
42-
- Default: 1024
42+
- Default: 1024
4343
- -DLOG_DIR=\<path to where the logs will be saved\>
44-
- Default: /var
44+
- Default: /var
45+
4546
```shell
4647
cd libLogHelper
4748
mkdir build && cd build
@@ -53,13 +54,19 @@ cmake ..
5354
make
5455
```
5556

56-
If you wish to install in the whole system
57+
If you wish to install in the whole system run the following commands.
5758

5859
```shell
5960
sudo make install
6061
sudo ldconfig
6162
```
6263

64+
After the installation, the file /etc/rc.local will be created.
65+
This file will run a script called atBoot.sh, containing any additional configurations
66+
to be performed immediately after the boot process.
67+
You can find and edit the default atBoot.sh commands that are executed after installation
68+
in your HOME directory.
69+
6370
To uninstall the library (LOG_DIR/radiation-benchmarks/ path is not deleted)
6471

6572
```shell
@@ -72,10 +79,12 @@ install_path>/lib
7279

7380
```C
7481
// include the header in your C code
75-
#include "log_helper.h"
82+
#include
83+
"log_helper.h"
7684
...
7785
// include the header in your C++ code
78-
#include "log_helper.hpp"
86+
#include
87+
"log_helper.hpp"
7988
```
8089

8190
### Python Wrapper
@@ -92,4 +101,5 @@ lh.start_log_file("MyBenchmark", "Myheader")
92101

93102
### How to use the library
94103

95-
Some dummy source codes in [examples/](https://github.com/radhelper/libLogHelper/tree/main/examples) directory contain the library's essential functions usage.
104+
Some dummy source codes in [examples/](https://github.com/radhelper/libLogHelper/tree/main/examples) directory contain
105+
the library's essential functions usage.

include/env_vars.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
#error "CONFIG_FILE_PATH not set check you CMake configurations"
2828
#endif
2929

30+
/** Deprecated: Timestamps are righter updated by UDP messages or signals to local watchdogs **/
3031
// Location of timestamp file for software watchdog
31-
#define TIMESTAMP_FILE "timestamp.txt"
32+
//#define TIMESTAMP_FILE "timestamp.txt"
3233

3334
#endif //LOGHELPER_ENV_VARS_H

src/log_helper.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,20 @@ namespace log_helper {
135135
static const auto run_signal = signal_cmd != "none";
136136
if (run_signal) {
137137
__attribute__((unused)) auto sys_ret = system(signal_cmd.c_str());
138-
// if (sys_ret != 0) {
139-
// EXCEPTION_MESSAGE("ERROR ON SYSTEM CMD " + signal_cmd);
140-
// }
141-
}
142-
143-
static const auto timestamp_watchdog_path = configuration_parameters[VAR_DIR_KEY] + "/" + TIMESTAMP_FILE;
144-
std::ofstream timestamp_file(timestamp_watchdog_path);
145-
if (timestamp_file.good()) {
146-
auto now = std::chrono::system_clock::now();
147-
auto now_ms = std::chrono::time_point_cast<std::chrono::milliseconds>(now);
148-
auto value = now_ms.time_since_epoch();
149-
timestamp_file << value.count();
150-
timestamp_file.close();
138+
if (sys_ret != 0) {
139+
DEBUG_MESSAGE("ERROR ON SYSTEM CMD " + signal_cmd);
140+
}
151141
}
142+
/** Deprecated: Timestamps are righter updated by UDP messages or signals to local watchdogs **/
143+
// static const auto timestamp_watchdog_path = configuration_parameters[VAR_DIR_KEY] + "/" + TIMESTAMP_FILE;
144+
// std::ofstream timestamp_file(timestamp_watchdog_path);
145+
// if (timestamp_file.good()) {
146+
// auto now = std::chrono::system_clock::now();
147+
// auto now_ms = std::chrono::time_point_cast<std::chrono::milliseconds>(now);
148+
// auto value = now_ms.time_since_epoch();
149+
// timestamp_file << value.count();
150+
// timestamp_file.close();
151+
// }
152152
#endif
153153
}
154154

@@ -184,7 +184,8 @@ namespace log_helper {
184184
}
185185
}
186186

187-
int32_t start_log_file(std::string benchmark_name, std::string test_info) { // NOLINT(performance-unnecessary-value-param)
187+
int32_t
188+
start_log_file(std::string benchmark_name, std::string test_info) { // NOLINT(performance-unnecessary-value-param)
188189
// Necessary for all configurations (network or local)
189190
read_configuration_file();
190191

0 commit comments

Comments
 (0)