OSDN Git Service

topology: improve the printf buffer management
authorJaroslav Kysela <perex@perex.cz>
Mon, 31 Aug 2020 17:44:46 +0000 (19:44 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 31 Aug 2020 17:51:49 +0000 (19:51 +0200)
commit472ab5db67a0ed04de634214773e7b17d10b5415
tree0bb6ff4d7439f585a467f5a01f9a8f24adb483f8
parentab73253924ad8d46f94ab1212e0f05ebc2e3dcc5
topology: improve the printf buffer management

The commit d04e72c9a593015952e4858b92ab3f9d821560d9 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>
src/topology/channel.c
src/topology/ctl.c
src/topology/dapm.c
src/topology/data.c
src/topology/ops.c
src/topology/pcm.c
src/topology/save.c
src/topology/text.c
src/topology/tplg_local.h