logger: Rename float_precision to time_precision

New name better describes variable functionality.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-06-23 13:34:59 +02:00 committed by Liam Girdwood
parent d97e9291e1
commit cb10221109
3 changed files with 17 additions and 17 deletions

View File

@ -212,13 +212,13 @@ static double to_usecs(uint64_t time, double clk)
static inline void print_table_header(FILE *out_fd, int hide_location,
int float_precision)
int time_precision)
{
char time_fmt[32];
if (float_precision >= 0) {
if (time_precision >= 0) {
snprintf(time_fmt, sizeof(time_fmt), "%%%ds %%%ds ",
float_precision + 12, float_precision + 12);
time_precision + 12, time_precision + 12);
fprintf(out_fd, time_fmt, "TIMESTAMP", "DELTA");
}
fprintf(out_fd, "%2s %-18s ", "C#", "COMPONENT");
@ -305,7 +305,7 @@ 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,
int hide_location, int float_precision)
int hide_location, int time_precision)
{
char ids[TRACE_MAX_IDS_STR];
float dt = to_usecs(dma_log->timestamp - last_timestamp, clock);
@ -328,9 +328,9 @@ static void print_entry_params(FILE *out_fd,
if (raw_output) {
const char *entry_fmt = "%s%u %u %s%s%s ";
if (float_precision >= 0)
if (time_precision >= 0)
snprintf(time_fmt, sizeof(time_fmt), "%%.%df %%.%df ",
float_precision, float_precision);
time_precision, time_precision);
fprintf(out_fd, entry_fmt,
entry->header.level == use_colors ?
@ -342,7 +342,7 @@ static void print_entry_params(FILE *out_fd,
dma_log->uid),
raw_output && strlen(ids) ? "-" : "",
ids);
if (float_precision >= 0)
if (time_precision >= 0)
fprintf(out_fd, time_fmt,
to_usecs(dma_log->timestamp, clock),
dt);
@ -352,11 +352,11 @@ static void print_entry_params(FILE *out_fd,
entry->header.line_idx);
} else {
/* timestamp */
if (float_precision >= 0) {
if (time_precision >= 0) {
snprintf(time_fmt, sizeof(time_fmt),
"%%s[%%%d.%df] (%%%d.%df)%%s ",
float_precision + 10, float_precision,
float_precision + 10, float_precision);
time_precision + 10, time_precision,
time_precision + 10, time_precision);
fprintf(out_fd, time_fmt,
use_colors ? KGRN : "",
to_usecs(dma_log->timestamp, clock), dt,
@ -532,7 +532,7 @@ static int fetch_entry(const struct convert_config *config,
dma_log, &entry, *last_timestamp,
config->clock, config->use_colors,
config->raw_output, config->hide_location,
config->float_precision);
config->time_precision);
*last_timestamp = dma_log->timestamp;
/* set f_ldc file position to the beginning */
@ -611,7 +611,7 @@ static int logger_read(const struct convert_config *config,
if (!config->raw_output)
print_table_header(config->out_fd, config->hide_location,
config->float_precision);
config->time_precision);
if (config->serial_fd >= 0)
/* Wait for CTRL-C */

View File

@ -38,7 +38,7 @@ struct convert_config {
int raw_output;
int dump_ldc;
int hide_location;
int float_precision;
int time_precision;
struct snd_sof_uids_header *uids_dict;
};

View File

@ -166,7 +166,7 @@ int main(int argc, char *argv[])
config.raw_output = 0;
config.dump_ldc = 0;
config.hide_location = 0;
config.float_precision = 6;
config.time_precision = 6;
while ((opt = getopt(argc, argv, optstring)) != -1) {
switch (opt) {
@ -217,14 +217,14 @@ int main(int argc, char *argv[])
config.hide_location = 1;
break;
case 'f':
config.float_precision = atoi(optarg);
if (config.float_precision < 0) {
config.time_precision = atoi(optarg);
if (config.time_precision < 0) {
usage();
return -EINVAL;
}
break;
case 'g':
config.float_precision = -1;
config.time_precision = -1;
break;
case 'd':
if (config.ldc_file) {