1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

smaller cleanups and output formatting

This commit is contained in:
Steffen Vogel 2015-03-31 18:13:43 +02:00
parent 97bd035fef
commit cd76dc525a
4 changed files with 16 additions and 19 deletions

View file

@ -36,9 +36,8 @@
/* Alternate character set */
#define ACS(chr) "\e(0" chr "\e(B"
#define ACS_VERTICAL "|"
#define ACS_HORIZONTAL ACS("\x71")
//#define ACS_VERTICAL ACS("\x78")
#define ACS_VERTICAL ACS("\x78")
#define ACS_VERTRIGHT ACS("\x74")
/* UTF-8 Line drawing characters */
@ -77,7 +76,7 @@ extern pthread_t _mtid;
*/
int strap(char *dest, size_t size, const char *fmt, ...);
/** Variable arguments (stdarg) version of strap() */
/** Variadic version of strap() */
int vstrap(char *dest, size_t size, const char *fmt, va_list va);
/** Convert integer to cpu_set_t.
@ -105,9 +104,8 @@ void die();
/** Check assertion and exit if failed. */
#define assert(exp) do { \
if (EXPECT(!exp, 0)) { \
print(ERROR, "Assertion failed: '%s' in %s, %s:%d", \
error, "Assertion failed: '%s' in %s, %s:%d", \
#exp, __FUNCTION__, __BASE_FILE__, __LINE__); \
exit(EXIT_FAILURE); \
} } while (0)
#endif /* _UTILS_H_ */

View file

@ -125,7 +125,7 @@ void hist_plot(struct hist *h)
}
/* Print plot */
info("%9s | %5s | %s", "Value", "Occur", "Histogram Plot:");
info("%9s | %5s | %s", "Value", "Occur", "Plot");
line();
for (int i = 0; i < h->length; i++) {

View file

@ -142,7 +142,7 @@ void serror(const char *fmt, ...)
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
log_print(ERROR, "%s: %s", buf, strerror(errno));
log_print(ERROR, "%s: %m (%u)", buf, errno);
die();
}
@ -161,4 +161,4 @@ void cerror(config_setting_t *cfg, const char *fmt, ...)
: "(stdio)",
config_setting_source_line(cfg));
die();
}
}

View file

@ -39,15 +39,15 @@ static config_t config;
static void quit()
{
info("Stopping paths:");
info("Stopping paths");
FOREACH(&paths, it)
path_stop(it->path);
info("Stopping nodes:");
info("Stopping nodes");
FOREACH(&nodes, it)
node_stop(it->node);
info("Stopping interfaces:");
info("Stopping interfaces");
FOREACH(&interfaces, it)
if_stop(it->interface);
@ -143,35 +143,34 @@ int main(int argc, char *argv[])
list_init(&paths, (dtor_cb_t) path_destroy);
list_init(&interfaces, (dtor_cb_t) if_destroy);
info("Initialize real-time system:");
info("Initialize real-time system");
realtime_init();
info("Initialize signals:");
info("Initialize signals");
signals_init();
info("Initialize node types:");
info("Initialize node types");
node_init(argc, argv);
info("Parsing configuration:");
info("Parsing configuration");
config_init(&config);
config_parse(configfile, &config, &settings, &nodes, &paths);
/* Connect all nodes and start one thread per path */
info("Starting nodes:");
info("Starting nodes");
FOREACH(&nodes, it)
node_start(it->node);
info("Starting interfaces:");
info("Starting interfaces");
FOREACH(&interfaces, it)
if_start(it->interface, settings.affinity);
info("Starting paths:");
info("Starting paths");
FOREACH(&paths, it)
path_start(it->path);
/* Run! */
if (settings.stats > 0) {
info("Runtime Statistics:");
info("%-32s : %-8s %-8s %-8s %-8s %-8s",
"Source " MAG("=>") " Destination", "#Sent", "#Recv", "#Drop", "#Skip", "#Inval");
line();