Change in libosmocore[master]: logging: Avoid memcpy from stack to msgb in _file_output()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Sep 29 17:59:28 UTC 2020


Hello pespin, Jenkins Builder, 

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/c/libosmocore/+/20305

to look at the new patch set (#3).

Change subject: logging: Avoid memcpy from stack to msgb in _file_output()
......................................................................

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).

Change-Id: I0d10b0199576d2e7ff6421a6dba19ae5ffafd946
---
M src/logging.c
1 file changed, 43 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/05/20305/3
-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20305
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0d10b0199576d2e7ff6421a6dba19ae5ffafd946
Gerrit-Change-Number: 20305
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200929/3d7374b0/attachment.htm>


More information about the gerrit-log mailing list