Skip to content

Commit

Permalink
Tools: Testbench: Suppress unnecessary prints when not debugging
Browse files Browse the repository at this point in the history
Testbench prints a lot of information that is not needed
in most of cases. With tb_debug_print() these can be
enabled with -d command line option. Also the topologies
contain lot of widgets those are skipped. Not printing
them by default helps to read the normal run prints. Also
some prints without linefeed in file.c are fixed to clean
up the look of debug prints.

Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu committed Oct 15, 2024
1 parent 1e14666 commit a0815d6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
12 changes: 6 additions & 6 deletions tools/testbench/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ static int file_free(struct processing_module *mod)
struct copier_data *ccd = module_get_private_data(mod);
struct file_comp_data *cd = get_file_comp_data(ccd);

tb_debug_print("file_free()");
tb_debug_print("file_free()\n");

if (cd->fs.mode == FILE_READ)
fclose(cd->fs.rfh);
Expand Down Expand Up @@ -771,7 +771,7 @@ static int file_process(struct processing_module *mod,
cd->fs.copy_count++;
if (cd->fs.reached_eof || (cd->max_copies && cd->fs.copy_count >= cd->max_copies)) {
cd->fs.reached_eof = true;
tb_debug_print("file_process(): reached EOF");
tb_debug_print("file_process(): reached EOF\n");
}

if (samples) {
Expand All @@ -798,7 +798,7 @@ static int file_prepare(struct processing_module *mod,
struct comp_dev *dev = mod->dev;
struct file_comp_data *cd = get_file_comp_data(module_get_private_data(mod));

tb_debug_print("file_prepare()");
tb_debug_print("file_prepare()\n");

/* file component sink/source buffer period count */
cd->max_frames = dev->frames;
Expand Down Expand Up @@ -840,14 +840,14 @@ static int file_reset(struct processing_module *mod)
{
struct file_comp_data *cd = module_get_private_data(mod);

tb_debug_print("file_reset()");
tb_debug_print("file_reset()\n");
cd->copies_timeout_count = 0;
return 0;
}

static int file_trigger(struct comp_dev *dev, int cmd)
{
tb_debug_print("file_trigger()");
tb_debug_print("file_trigger()\n");
return comp_set_state(dev, cmd);
}

Expand All @@ -857,7 +857,7 @@ static int file_get_hw_params(struct comp_dev *dev,
struct processing_module *mod = comp_mod(dev);
struct file_comp_data *cd = get_file_comp_data(module_get_private_data(mod));

tb_debug_print("file_hw_params()");
tb_debug_print("file_hw_params()\n");
params->direction = dir;
params->rate = cd->rate;
params->channels = cd->channels;
Expand Down
7 changes: 4 additions & 3 deletions tools/testbench/topology_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,10 @@ static int tb_load_widget(struct testbench_prm *tb, struct tplg_context *ctx)
break;
/* unsupported widgets */
default:
printf("info: Widget %s id %d unsupported and skipped: size %d priv size %d\n",
ctx->widget->name, ctx->widget->id,
ctx->widget->size, ctx->widget->priv.size);
if (host_trace_level >= LOG_LEVEL_DEBUG)
printf("debug: Widget %s id %d unsupported and skipped: size %d priv size %d\n",
ctx->widget->name, ctx->widget->id,
ctx->widget->size, ctx->widget->priv.size);
break;
}

Expand Down
11 changes: 6 additions & 5 deletions tools/testbench/topology_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,10 @@ static int tb_load_widget(struct testbench_prm *tp)

/* unsupported widgets */
default:
printf("info: Widget %s id %d unsupported and skipped: size %d priv size %d\n",
ctx->widget->name, ctx->widget->id,
ctx->widget->size, ctx->widget->priv.size);
if (host_trace_level >= LOG_LEVEL_DEBUG)
printf("Widget %s id %d unsupported and skipped: size %d priv size %d\n",
ctx->widget->name, ctx->widget->id,
ctx->widget->size, ctx->widget->priv.size);
break;
}

Expand Down Expand Up @@ -1150,7 +1151,7 @@ int tb_set_running_state(struct testbench_prm *tp)
return ret;
}

fprintf(stdout, "pipelines are set to paused state\n");
tb_debug_print("pipelines are set to paused state\n");
ret = tb_pipelines_set_state(tp, SOF_IPC4_PIPELINE_STATE_RUNNING, SOF_IPC_STREAM_PLAYBACK);
if (ret) {
fprintf(stderr, "error: failed to set state to running\n");
Expand All @@ -1161,7 +1162,7 @@ int tb_set_running_state(struct testbench_prm *tp)
if (ret)
fprintf(stderr, "error: failed to set state to running\n");

fprintf(stdout, "pipelines are set to running state\n");
tb_debug_print("pipelines are set to running state\n");
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion tools/testbench/utils_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ int tb_set_up_all_pipelines(struct testbench_prm *tp)
return ret;
}

fprintf(stdout, "pipelines set up complete\n");
tb_debug_print("pipelines set up complete\n");
return 0;
}

Expand Down

0 comments on commit a0815d6

Please sign in to comment.