From de02d0786d4075091f5b1860474cd21d85ff5862 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 20 Sep 2011 21:43:24 +0100 Subject: ASoC: Trace and collect statistics for DAPM graph walking One of the longest standing areas for improvement in ASoC has been the DAPM algorithm - it repeats the same checks many times whenever it is run and makes no effort to limit the areas of the graph it checks meaning we do an awful lot of walks over the full graph. This has never mattered too much as the size of the graph has generally been small in relation to the size of the devices supported and the speed of CPUs but it is annoying. In preparation for work on improving this insert a trace point after the graph walk has been done. This gives us specific timing information for the walk, and in order to give quantifiable (non-benchmark) numbers also count every time we check a link or check the power for a widget and report those numbers. Substantial changes in the algorithm may require tweaks to the stats but they should be useful for simpler things. Signed-off-by: Mark Brown --- include/trace/events/asoc.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/trace') diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h index 603f5a0f036..2e1adf62e0a 100644 --- a/include/trace/events/asoc.h +++ b/include/trace/events/asoc.h @@ -216,6 +216,28 @@ DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_event_done, ); +TRACE_EVENT(snd_soc_dapm_walk_done, + + TP_PROTO(struct snd_soc_card *card), + + TP_ARGS(card), + + TP_STRUCT__entry( + __string( name, card->name ) + __field( int, power_checks ) + __field( int, path_checks ) + ), + + TP_fast_assign( + __assign_str(name, card->name); + __entry->power_checks = card->dapm_stats.power_checks; + __entry->path_checks = card->dapm_stats.path_checks; + ), + + TP_printk("%s: %d power checks, %d path checks", __get_str(name), + (int)__entry->power_checks, (int)__entry->path_checks) +); + TRACE_EVENT(snd_soc_jack_irq, TP_PROTO(const char *name), -- cgit v1.2.3 From e56235e099d7290a2331b984a79f75bbe0865fe8 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 21 Sep 2011 18:19:14 +0100 Subject: ASoC: Add another DAPM stat for neighbour checks The number of times we look at a potentially connected neighbour is just as important as the number of times we actually recurse into looking at that neighbour so also collect that statistic. Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 1 + include/trace/events/asoc.h | 7 +++++-- sound/soc/soc-dapm.c | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'include/trace') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 0e2d01713cb..bb5953219d0 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -540,6 +540,7 @@ struct snd_soc_dapm_widget_list { struct snd_soc_dapm_stats { int power_checks; int path_checks; + int neighbour_checks; }; #endif diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h index 2e1adf62e0a..ab26f8aa3c7 100644 --- a/include/trace/events/asoc.h +++ b/include/trace/events/asoc.h @@ -226,16 +226,19 @@ TRACE_EVENT(snd_soc_dapm_walk_done, __string( name, card->name ) __field( int, power_checks ) __field( int, path_checks ) + __field( int, neighbour_checks ) ), TP_fast_assign( __assign_str(name, card->name); __entry->power_checks = card->dapm_stats.power_checks; __entry->path_checks = card->dapm_stats.path_checks; + __entry->neighbour_checks = card->dapm_stats.neighbour_checks; ), - TP_printk("%s: %d power checks, %d path checks", __get_str(name), - (int)__entry->power_checks, (int)__entry->path_checks) + TP_printk("%s: checks %d power, %d path, %d neighbour", + __get_str(name), (int)__entry->power_checks, + (int)__entry->path_checks, (int)__entry->neighbour_checks) ); TRACE_EVENT(snd_soc_jack_irq, diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 84d1d799a0d..6cac04595cc 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -677,6 +677,8 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget) } list_for_each_entry(path, &widget->sinks, list_source) { + DAPM_UPDATE_STAT(widget, neighbour_checks); + if (path->weak) continue; @@ -732,6 +734,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) } list_for_each_entry(path, &widget->sources, list_sink) { + DAPM_UPDATE_STAT(widget, neighbour_checks); + if (path->weak) continue; -- cgit v1.2.3