aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gb
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-09-27 17:15:10 +0200
committerHarald Welte <laforge@osmocom.org>2021-10-26 17:16:50 +0200
commita0b57d06885572406943bc42884c2d189d541aee (patch)
tree6c8ab3a4912a5f3566c4f1ce12b01fae213f50b1 /tests/gb
parentb72867f0e68c96ca25e1f9929ce92be0a802db6b (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 'tests/gb')
0 files changed, 0 insertions, 0 deletions