Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
Logger add possibility to make logs output more compact#2905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -204,11 +204,19 @@ static double to_usecs(uint64_t time, double clk) | ||
| } | ||
| static inline void print_table_header(FILE *out_fd) | ||
| static inline void print_table_header(FILE *out_fd, int hide_location, | ||
| int float_precision) | ||
| { | ||
| fprintf(out_fd, "%18s %18s %2s %-18s %-29s %s\n", | ||
| "TIMESTAMP", "DELTA", "C#", "COMPONENT", "LOCATION", | ||
| "CONTENT"); | ||
| char time_fmt[32]; | ||
| snprintf(time_fmt, sizeof(time_fmt), "%%%ds %%%ds ", | ||
| float_precision + 12, float_precision + 12); | ||
| fprintf(out_fd, time_fmt, "TIMESTAMP", "DELTA"); | ||
| fprintf(out_fd, "%2s %-18s ", "C#", "COMPONENT"); | ||
| if (!hide_location) | ||
| fprintf(out_fd, "%-29s ", "LOCATION"); | ||
| fprintf(out_fd, "%s\n", "CONTENT"); | ||
| fflush(out_fd); | ||
| } | ||
| @@ -315,11 +323,13 @@ static char *format_file_name(char *file_name_raw, int full_name) | ||
| static void print_entry_params(FILE *out_fd, | ||
| const struct snd_sof_uids_header *uids_dict, | ||
| const struct log_entry_header *dma_log, const struct ldc_entry *entry, | ||
| uint64_t last_timestamp, double clock, int use_colors, int raw_output) | ||
| uint64_t last_timestamp, double clock, int use_colors, int raw_output, | ||
| int hide_location, int float_precision) | ||
| { | ||
| char ids[TRACE_MAX_IDS_STR]; | ||
| float dt = to_usecs(dma_log->timestamp - last_timestamp, clock); | ||
| struct proc_ldc_entry proc_entry; | ||
| static char time_fmt[32]; | ||
| if (raw_output) | ||
| use_colors = 0; | ||
| @@ -335,7 +345,10 @@ static void print_entry_params(FILE *out_fd, | ||
| ids[0] = '\0'; | ||
| if (raw_output) { | ||
| const char *entry_fmt = "%s%u %u %s%s%s %.6f %.6f (%s:%u) "; | ||
| const char *entry_fmt = "%s%u %u %s%s%s "; | ||
| snprintf(time_fmt, sizeof(time_fmt), "%%.%df %%.%df ", | ||
| float_precision, float_precision); | ||
| fprintf(out_fd, entry_fmt, | ||
| entry->header.level == use_colors ? | ||
| @@ -346,14 +359,20 @@ static void print_entry_params(FILE *out_fd, | ||
| entry->header.component_class, | ||
| dma_log->uid), | ||
| raw_output && strlen(ids) ? "-" : "", | ||
| ids, | ||
| to_usecs(dma_log->timestamp, clock), | ||
| dt, | ||
| format_file_name(entry->file_name, raw_output), | ||
| entry->header.line_idx); | ||
| ids); | ||
| fprintf(out_fd, time_fmt, to_usecs(dma_log->timestamp, clock), | ||
| dt); | ||
| if (!hide_location) | ||
| fprintf(out_fd, "(%s:%u) ", | ||
| format_file_name(entry->file_name, raw_output), | ||
| entry->header.line_idx); | ||
| } else { | ||
| /* timestamp */ | ||
| fprintf(out_fd, "%s[%16.6f] (%16.6f)%s ", | ||
| snprintf(time_fmt, sizeof(time_fmt), | ||
| "%%s[%%%d.%df] (%%%d.%df)%%s ", | ||
| float_precision + 10, float_precision, | ||
| float_precision + 10, float_precision); | ||
| ||
| fprintf(out_fd, time_fmt, | ||
| use_colors ? KGRN : "", | ||
| to_usecs(dma_log->timestamp, clock), dt, | ||
| use_colors ? KNRM : ""); | ||
| @@ -371,9 +390,10 @@ static void print_entry_params(FILE *out_fd, | ||
| use_colors ? KNRM : ""); | ||
| /* location */ | ||
| fprintf(out_fd, "%24s:%-4u ", | ||
| format_file_name(entry->file_name, raw_output), | ||
| entry->header.line_idx); | ||
| if (!hide_location) | ||
| fprintf(out_fd, "%24s:%-4u ", | ||
| format_file_name(entry->file_name, raw_output), | ||
| entry->header.line_idx); | ||
| /* level name */ | ||
| fprintf(out_fd, "%s%s", | ||
| @@ -525,7 +545,8 @@ static int fetch_entry(const struct convert_config *config, | ||
| config->uids_dict, | ||
| dma_log, &entry, *last_timestamp, | ||
| config->clock, config->use_colors, | ||
| config->raw_output); | ||
| config->raw_output, config->hide_location, | ||
| config->float_precision); | ||
| *last_timestamp = dma_log->timestamp; | ||
| /* set f_ldc file position to the beginning */ | ||
| @@ -603,7 +624,8 @@ static int logger_read(const struct convert_config *config, | ||
| uint64_t last_timestamp = 0; | ||
| if (!config->raw_output) | ||
| print_table_header(config->out_fd); | ||
| print_table_header(config->out_fd, config->hide_location, | ||
| config->float_precision); | ||
| if (config->serial_fd >= 0) | ||
| /* Wait for CTRL-C */ | ||
Uh oh!
There was an error while loading. Please reload this page.