mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
smaller cleanups
This commit is contained in:
parent
49a7686780
commit
872153b458
4 changed files with 17 additions and 24 deletions
|
@ -19,9 +19,12 @@
|
|||
#include "hooks.h"
|
||||
|
||||
#include "socket.h"
|
||||
#include "gtfpga.h"
|
||||
|
||||
#ifdef ENABLE_GTFPGA
|
||||
#include "gtfpga.h"
|
||||
#endif
|
||||
#ifdef ENABLE_OPAL_ASYNC
|
||||
#include "opal.h"
|
||||
#include "opal.h"
|
||||
#endif
|
||||
|
||||
int config_parse(const char *filename, config_t *cfg, struct settings *set,
|
||||
|
@ -139,8 +142,7 @@ int config_parse_path(config_setting_t *cfg,
|
|||
|
||||
if (reverse) {
|
||||
if (list_length(&p->destinations) > 1)
|
||||
warn("Using first destination '%s' as source for reverse path. "
|
||||
"Ignoring remaining nodes", p->out->name);
|
||||
error("Can't reverse path with multiple destination nodes");
|
||||
|
||||
struct path *r = path_create();
|
||||
|
||||
|
|
|
@ -95,25 +95,24 @@ double hist_stddev(struct hist *h)
|
|||
|
||||
void hist_print(struct hist *h)
|
||||
{ INDENT
|
||||
char buf[h->length * 8];
|
||||
hist_dump(h, buf, sizeof(buf));
|
||||
|
||||
info("Total: %u values between %f and %f", h->total, h->low, h->high);
|
||||
info("Missed: %u (above), %u (below) ", h->higher, h->lower);
|
||||
info("Highest value: %f, lowest %f", h->highest, h->lowest);
|
||||
info("Mean: %f", hist_mean(h));
|
||||
info("Variance: %f", hist_var(h));
|
||||
info("Standard derivation: %f", hist_stddev(h));
|
||||
|
||||
|
||||
hist_plot(h);
|
||||
|
||||
char buf[h->length * 8];
|
||||
hist_dump(h, buf, sizeof(buf));
|
||||
|
||||
info("hist = %s", buf);
|
||||
info(buf);
|
||||
}
|
||||
|
||||
void hist_plot(struct hist *h)
|
||||
{
|
||||
unsigned min = UINT_MAX;
|
||||
unsigned max = 0;
|
||||
char buf[HIST_HEIGHT] = { '#' };
|
||||
unsigned int min = UINT_MAX, max = 0;
|
||||
|
||||
/* Get max, first & last */
|
||||
for (int i = 0; i < h->length; i++) {
|
||||
|
@ -123,9 +122,6 @@ void hist_plot(struct hist *h)
|
|||
min = h->data[i];
|
||||
}
|
||||
|
||||
char buf[HIST_HEIGHT];
|
||||
memset(buf, '#', HIST_HEIGHT);
|
||||
|
||||
/* Print plot */
|
||||
info("%9s | %5s | %s", "Value", "Occur", "Histogram Plot:");
|
||||
for (int i = 0; i < h->length; i++) {
|
||||
|
|
|
@ -65,8 +65,6 @@ int hook_log(struct msg *m, struct path *p)
|
|||
localtime_r(&ts, &tm);
|
||||
strftime(fstr, sizeof(fstr), HOOK_LOG_TEMPLATE, &tm);
|
||||
|
||||
|
||||
|
||||
file = fopen(fstr, HOOK_LOG_MODE);
|
||||
if (file)
|
||||
debug(5, "Opened log file for path %s: %s", pstr, fstr);
|
||||
|
|
|
@ -87,7 +87,7 @@ void realtime_init()
|
|||
|
||||
/* Setup exit handler */
|
||||
void signals_init()
|
||||
{ INDENT
|
||||
{
|
||||
struct sigaction sa_quit = {
|
||||
.sa_flags = SA_SIGINFO,
|
||||
.sa_sigaction = quit
|
||||
|
@ -142,12 +142,11 @@ int main(int argc, char *argv[])
|
|||
list_init(&nodes, (dtor_cb_t) node_destroy);
|
||||
list_init(&paths, (dtor_cb_t) path_destroy);
|
||||
list_init(&interfaces, (dtor_cb_t) if_destroy);
|
||||
|
||||
|
||||
info("Initialize realtime system:");
|
||||
|
||||
info("Initialize real-time system:");
|
||||
realtime_init();
|
||||
|
||||
info("Setup signals:");
|
||||
info("Initialize signals:");
|
||||
signals_init();
|
||||
|
||||
info("Initialize node types:");
|
||||
|
@ -155,8 +154,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
info("Parsing configuration:");
|
||||
config_init(&config);
|
||||
|
||||
/* Parse configuration and create nodes/paths */
|
||||
config_parse(configfile, &config, &settings, &nodes, &paths);
|
||||
|
||||
/* Connect all nodes and start one thread per path */
|
||||
|
|
Loading…
Add table
Reference in a new issue