aboutsummaryrefslogtreecommitdiffstats
path: root/COPYING
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-09-27 17:15:10 +0200
committerHarald Welte <laforge@osmocom.org>2021-02-03 14:56:17 +0100
commite01de122c13247fb90fdae9531aa00f729f3099a (patch)
tree58052273040ef806c3da1b32b4b8dcff81df8013 /COPYING
parent79147db7412b6ebba615c0d383eebc209ac6f123 (diff)
logging: Avoid memcpy from stack to msgb in _file_output()
For file and stderr output, the existing code always generates the log string on a stack buffer, and then (in case of non-blocking write via write_queue) copies it over to a msgb. Let's optimize this by turning _file_output() into a raw_output callback which first allocates the msgb and then format-prints directly to that msgb instaed of stack + memcpy. This has the disadvantage that we don't know how long the buffer has to be in order to print the entire string to it. As a result we always have to allocate a 4k-sized buffer (plus msgb overhead). The write_queue length for log file output has been decreased from 1024 entries to 156 entries in order to stay within the same memory requirements for each log target memory pool (about 648 kBytes). Related: OS#4311 Change-Id: I0d10b0199576d2e7ff6421a6dba19ae5ffafd946
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions