libosmocore/src
Harald Welte a0b57d0688 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
2021-10-26 17:16:50 +02:00
..
codec codec: Add functions for AMR s->d bits and d->s bits 2020-05-14 14:51:22 +02:00
coding gsm0503_coding: use ahs tables when encoding ahs codec id 2021-08-31 16:05:20 +02:00
ctrl revisit some calls of strtol(), stroul(), strtoull() 2021-10-04 11:24:59 +00:00
gb ns2: correct parse a BLOCK PDU which was received over a different NSVC 2021-10-15 13:39:31 +00:00
gsm revisit some calls of strtol(), stroul(), strtoull() 2021-10-04 11:24:59 +00:00
pseudotalloc pseudotalloc: Simplistic wrapper of talloc_named() 2019-07-31 10:16:07 +02:00
sim sim: Add osim_card_{reset,close}() API 2021-06-01 20:29:17 +02:00
usb usb: Add osmo_libusb_find_open_claim() all-in-one API 2020-05-12 05:43:21 +00:00
vty logging: Change stderr + file target to use non-blocking write 2021-10-26 17:16:47 +02:00
Makefile.am refactor stat_item: get rid of FIFO and "skipped" error 2021-09-30 18:33:43 +00:00
application.c application.c: drop wrong \references of osmo_init_ignore_signals() 2019-04-25 02:23:52 +07:00
backtrace.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
base64.c base64: reformat using Lindent to conform to our coding style 2021-09-21 19:57:56 +00:00
bitcomp.c bitcomp.c: fix missing Doxygen group closing tag 2019-04-25 02:23:52 +07:00
bits.c bits.c: Use faster look-up-table approach for osmo_revbytebits_{buf,u8} 2020-08-02 11:30:31 +02:00
bitvec.c bitvec: Fix left shifting out of range on signed variable 2020-11-13 12:09:02 +01:00
context.c context: Add support for [per-thread] global talloc contexts 2019-08-27 13:43:31 +02:00
conv.c conv: prevent theoretical NULL pointer dereference in osmo_conv_encode() 2020-02-09 04:27:47 +07:00
conv_acc.c libomsocoding: NEON viterbi acceleration 2020-08-06 16:47:40 +00:00
conv_acc_generic.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
conv_acc_neon.c libomsocoding: NEON viterbi acceleration 2020-08-06 16:47:40 +00:00
conv_acc_neon_impl.h libomsocoding: NEON viterbi acceleration 2020-08-06 16:47:40 +00:00
conv_acc_sse.c conv_acc: Our code requires SSSE3, not just SSE3 2017-11-17 11:44:22 +01:00
conv_acc_sse_avx.c conv_acc: Our code requires SSSE3, not just SSE3 2017-11-17 11:44:22 +01:00
conv_acc_sse_impl.h Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
counter.c counters: add osmo_counters_count() returns the amount of counters 2017-12-05 16:06:27 +01:00
crc16.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
crcXXgen.c.tpl Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
exec.c exec: osmo_system_nowait2: initalize *pw pointer with NULL 2020-05-12 11:03:51 +00:00
fsm.c fsm: cosmetic: fix weird spacing in osmo_fsm_inst_alloc() 2021-06-04 20:07:10 +00:00
gsmtap_util.c gsm_08_58.h: add Osmocom specific Bm/Lm CBITs for VAMOS 2021-05-26 21:18:11 +02:00
isdnhdlc.c isdnhdlc: Port from kernel to userspace 2018-05-11 21:57:46 +02:00
it_q.c Add inter-thread queue 2021-01-06 00:22:13 +01:00
logging.c logging: Avoid memcpy from stack to msgb in _file_output() 2021-10-26 17:16:50 +02:00
logging_gsmtap.c logging: gsmtap: Store TID instead of PID in pkt hdr 2021-02-17 18:55:46 +01:00
logging_syslog.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
logging_systemd.c logging: introduce 'systemd-journal' target 2020-10-19 15:02:00 +00:00
loggingrb.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
macaddr.c macaddr: fix osmo_macaddr_parse(): return meaningful error codes 2020-08-27 01:10:51 +07:00
mnl.c mnl: Use mnl_socket_open() insatead of mnl_socket_open2() 2020-12-04 10:29:07 +01:00
msgb.c cosmetic: Fix typo in API doc 2020-09-27 12:58:23 +02:00
msgfile.c memleak: osmo_config_list_parse: getline() needs free also on error 2017-11-18 10:30:57 +00:00
panic.c osmo_panic(): Annotate as __attribute__ ((noreturn)) 2018-06-29 20:32:57 +02:00
plugin.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
prbs.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
prim.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
probes.d support for stats static userspace probes via systemtap 2021-02-22 09:58:00 +01:00
rate_ctr.c stat,rate_ctr: Allow setting group name and use it at report time 2021-06-05 15:46:27 +00:00
rbtree.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
select.c osmo_select_shutdown_request(): allow finishing pending writes on SIGTERM 2021-06-18 12:22:44 +00:00
sercomm.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
serial.c serial: Introduce API osmo_serial_speed_t 2020-11-13 22:58:14 +01:00
signal.c Revert "signal.c: Make non-exported tall_sigh_ctx static" 2019-03-22 13:25:01 +01:00
sockaddr_str.c sockaddr_str: add osmo_sockaddr_str_from_str2() which doesn't set the port 2020-09-02 15:22:57 +00:00
socket.c gsmtap: allow 127.0.0.x local listeners 2021-10-06 13:01:26 +00:00
stat_item.c refactor stat_item: get rid of FIFO and "skipped" error 2021-09-30 18:33:43 +00:00
stat_item_internal.h refactor stat_item: get rid of FIFO and "skipped" error 2021-09-30 18:33:43 +00:00
stats.c refactor stat_item: report only changed values 2021-09-30 18:33:43 +00:00
stats_statsd.c stat,rate_ctr: Allow setting group name and use it at report time 2021-06-05 15:46:27 +00:00
strrb.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
tdef.c fix default_timeout type of osmo_tdef_fsm_inst_state_chg default_timeout 2021-04-28 18:31:31 +00:00
thread.c Introduce osmo_gettid() API 2021-02-17 18:24:17 +01:00
timer.c osmo_timer_pending: Make arg const 2021-04-29 20:14:51 +00:00
timer_clockgettime.c Fix embedded (arm-none-eabi) builds 2018-06-28 10:30:34 +02:00
timer_gettimeofday.c timer: Document osmo_gettimeofday API 2018-03-01 12:33:03 +00:00
use_count.c osmo_use_count_to_str: make robust against unused use_count 2020-09-30 18:48:12 +00:00
utils.c utils: introduce osmo_talloc_replace_string_fmt() 2021-10-13 14:03:26 +03:00
write_queue.c write_queue: Re-enqueue msgb if write_cb returns -EAGAIN 2020-09-29 16:58:11 +00:00