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

format: Allow printing test meta data to result file

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel 2024-05-27 12:49:58 +02:00 committed by pipeacosta
parent 247f1ead42
commit bae0a37526
4 changed files with 13 additions and 1 deletions

View file

@ -55,12 +55,16 @@ public:
virtual void start() {}
virtual void reset() {}
virtual void parse(json_t *json);
virtual int print(FILE *f, const struct Sample *const smps[], unsigned cnt);
virtual int scan(FILE *f, struct Sample *const smps[], unsigned cnt);
virtual void printMetadata(FILE *f, json_t *json) {}
/* Print \p cnt samples from \p smps into buffer \p buf of length \p len.
*
* @param buf[out] The buffer which should be filled with serialized data.

View file

@ -38,6 +38,10 @@ public:
header_printed = true;
}
virtual void reset() { header_printed = false; }
virtual void printMetadata(FILE *f, json_t *json);
virtual int sprint(char *buf, size_t len, size_t *wbytes,
const struct Sample *const smps[], unsigned cnt);
virtual int sscan(const char *buf, size_t len, size_t *rbytes,

View file

@ -137,7 +137,7 @@ void ColumnLineFormat::header(FILE *f, const SignalList::Ptr sigs) {
return;
if (comment)
fprintf(f, "%c", comment);
fprintf(f, "%c ", comment);
if (flags & (int)SampleFlags::HAS_TS_ORIGIN)
fprintf(f, "secs%cnsecs%c", separator, separator);

View file

@ -163,3 +163,7 @@ void LineFormat::parse(json_t *json) {
Format::parse(json);
}
void LineFormat::printMetadata(FILE *f, json_t *json) {
fprintf(f, "# %s\n", json_dumps(json, 0));
}