mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-29 07:57:59 -04:00
topology: improve the printf buffer management
The commit d04e72c9a5 introduced
the dynamic printf buffer allocation for each tplg_save_printf()
call.
Introduce 'struct tplg_buf' which carries extra information about
the temporary printf buffer and the destination buffer to save allocation
requests.
The printf buffer is also allocated using 1024 bytes chunks.
A comparison between 'alloc everyting' and 'cache+chunk alloc' for the
random picked topology file:
1: 18,620 allocs, 18,620 frees, 7,239,688 bytes allocated
2: 12,490 allocs, 12,490 frees, 962,568 bytes allocated
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
ab73253924
commit
472ab5db67
9 changed files with 130 additions and 97 deletions
|
|
@ -416,7 +416,8 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
}
|
||||
|
||||
/* save DAPM graph */
|
||||
int tplg_save_dapm_graph(snd_tplg_t *tplg, int index, char **dst, const char *pfx)
|
||||
int tplg_save_dapm_graph(snd_tplg_t *tplg, int index,
|
||||
struct tplg_buf *dst, const char *pfx)
|
||||
{
|
||||
struct snd_soc_tplg_dapm_graph_elem *route;
|
||||
struct list_head *pos;
|
||||
|
|
@ -669,7 +670,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg,
|
|||
/* save DAPM widget */
|
||||
int tplg_save_dapm_widget(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
||||
struct tplg_elem *elem,
|
||||
char **dst, const char *pfx)
|
||||
struct tplg_buf *dst, const char *pfx)
|
||||
{
|
||||
struct snd_soc_tplg_dapm_widget *widget = elem->widget;
|
||||
const char *s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue