Skip to content

Commit

Permalink
Merge pull request #296 from lf-lang/cleanup-warnings
Browse files Browse the repository at this point in the history
Clean up warnings and associated docs
  • Loading branch information
edwardalee authored Oct 28, 2023
2 parents e5ae698 + d707dcc commit 6141687
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/platform/lf_unix_clock_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
12 changes: 5 additions & 7 deletions util/tracing/trace_to_chrome.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion util/tracing/trace_to_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion util/tracing/trace_to_influxdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
9 changes: 0 additions & 9 deletions util/tracing/trace_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion util/tracing/trace_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 6141687

Please sign in to comment.