From d707dcc20525c9cb5043b28695c214ef9b90c5ef Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Fri, 27 Oct 2023 17:35:21 -0700 Subject: [PATCH] Clean up warnings and associated docs --- core/platform/lf_unix_clock_support.c | 2 +- util/tracing/trace_to_chrome.c | 12 +++++------- util/tracing/trace_to_csv.c | 2 +- util/tracing/trace_to_influxdb.c | 2 +- util/tracing/trace_util.c | 9 --------- util/tracing/trace_util.h | 2 +- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/core/platform/lf_unix_clock_support.c b/core/platform/lf_unix_clock_support.c index e20cb0b8f..3fb918275 100644 --- a/core/platform/lf_unix_clock_support.c +++ b/core/platform/lf_unix_clock_support.c @@ -58,7 +58,7 @@ void _lf_initialize_clock() { lf_print_error_and_exit("Could not obtain resolution for _LF_CLOCK"); } - lf_print("---- System clock resolution: %u nsec", res.tv_nsec); + lf_print("---- System clock resolution: %ld nsec", res.tv_nsec); } /** diff --git a/util/tracing/trace_to_chrome.c b/util/tracing/trace_to_chrome.c index 8e0c29dba..ec4cb1b1e 100644 --- a/util/tracing/trace_to_chrome.c +++ b/util/tracing/trace_to_chrome.c @@ -69,13 +69,11 @@ int max_reaction_number = 0; bool physical_time_only = false; /** - * Read a trace in the specified file and write it to the specified json file. - * @param trace_file An open trace file. - * @param output_file An open output .json file. + * Read a trace in the trace_file and write it to the output_file in json. * @return The number of records read or 0 upon seeing an EOF. */ -size_t read_and_write_trace(FILE* trace_file, FILE* output_file) { - int trace_length = read_trace(trace_file); +size_t read_and_write_trace() { + int trace_length = read_trace(); if (trace_length == 0) return 0; // Write each line. for (int i = 0; i < trace_length; i++) { @@ -442,10 +440,10 @@ int main(int argc, char* argv[]) { strcat(json_filename, ".json"); output_file = open_file(json_filename, "w"); - if (read_header(trace_file) >= 0) { + if (read_header() >= 0) { // Write the opening bracket into the json file. fprintf(output_file, "{ \"traceEvents\": [\n"); - while (read_and_write_trace(trace_file, output_file) != 0) {}; + while (read_and_write_trace() != 0) {}; write_metadata_events(output_file); fprintf(output_file, "]}\n"); } diff --git a/util/tracing/trace_to_csv.c b/util/tracing/trace_to_csv.c index 1abf08c08..9f237adb4 100644 --- a/util/tracing/trace_to_csv.c +++ b/util/tracing/trace_to_csv.c @@ -97,7 +97,7 @@ summary_stats_t** summary_stats; instant_t latest_time = 0LL; /** - * Read a trace in the specified file and write it to the specified CSV file. + * Read a trace in the trace_file and write it to the output_file as CSV. * @return The number of records read or 0 upon seeing an EOF. */ size_t read_and_write_trace() { diff --git a/util/tracing/trace_to_influxdb.c b/util/tracing/trace_to_influxdb.c index 4f7f0ff85..c7d6db55b 100644 --- a/util/tracing/trace_to_influxdb.c +++ b/util/tracing/trace_to_influxdb.c @@ -145,7 +145,7 @@ void usage() { instant_t latest_time = 0LL; /** - * Read a trace in the specified file and write it to the specified CSV file. + * Read a trace in the trace_file and write it to InfluxDB. * @return The number of records read or 0 upon seeing an EOF. */ size_t read_and_write_trace() { diff --git a/util/tracing/trace_util.c b/util/tracing/trace_util.c index 551ec9447..902a97298 100644 --- a/util/tracing/trace_util.c +++ b/util/tracing/trace_util.c @@ -199,10 +199,6 @@ void print_table() { printf("-------\n"); } -/** - * Read header information. - * @return The number of objects in the object table or -1 for failure. - */ size_t read_header() { // Read the start time. int items_read = fread(&start_time, sizeof(instant_t), 1, trace_file); @@ -266,11 +262,6 @@ size_t read_header() { return object_table_size; } -/** - * Read the trace from the specified file and put it in the trace global - * variable. Return the length of the trace. - * @return The number of trace record read or 0 upon seeing an EOF. - */ int read_trace() { // Read first the int giving the length of the trace. int trace_length; diff --git a/util/tracing/trace_util.h b/util/tracing/trace_util.h index dab1f5e98..6f8774035 100644 --- a/util/tracing/trace_util.h +++ b/util/tracing/trace_util.h @@ -127,7 +127,7 @@ void print_table(); size_t read_header(); /** - * Read the trace from the specified file and put it in the trace global + * Read the trace from the trace_file and put it in the trace global * variable. Return the length of the trace. * @return The number of trace record read or 0 upon seeing an EOF. */