1# Copyright (c) 2021 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4menu "Processing"
5
6if !LOG_MODE_MINIMAL
7
8config LOG_PRINTK
9	bool "Process printk messages"
10	depends on !USERSPACE
11	default y if PRINTK
12	help
13	  If enabled, printk messages are redirected to the logging subsystem.
14	  The messages are formatted in place and logged unconditionally.
15
16if LOG_MODE_DEFERRED && !LOG_FRONTEND_ONLY
17
18config LOG_MODE_OVERFLOW
19	bool "Drop oldest message when full"
20	default y
21	help
22	  If enabled, then if there is no space to log a new message, the
23	  oldest one is dropped. If disabled, current message is dropped.
24
25config LOG_BLOCK_IN_THREAD
26	bool "Block in thread context on full"
27	depends on MULTITHREADING
28	help
29	  When enabled logger will block (if in the thread context) when
30	  internal logger buffer is full and new message cannot be allocated.
31
32config LOG_BLOCK_IN_THREAD_TIMEOUT_MS
33	int "Maximum time (in milliseconds) thread can be blocked"
34	default 1000
35	range -1 10000
36	depends on LOG_BLOCK_IN_THREAD
37	help
38	  If new buffer for a log message cannot be allocated in that time, log
39	  message is dropped. Forever blocking (-1) is possible however may lead
40	  to the logger deadlock if logging is enabled in threads used for
41	  logging (e.g. logger or shell thread).
42
43config LOG_PROCESS_TRIGGER_THRESHOLD
44	int "Number of buffered log messages before flushing"
45	default 10
46	depends on MULTITHREADING
47	help
48	  When number of buffered messages reaches the threshold thread is waken
49	  up. Log processing thread ID is provided during log initialization.
50	  Set 0 to disable the feature. If LOG_PROCESS_THREAD is enabled then
51	  this threshold is used by the internal thread.
52
53config LOG_PROCESS_THREAD
54	bool "Use internal thread for log processing"
55	depends on MULTITHREADING
56	default y
57	help
58	  When enabled thread is created by the logger subsystem. Thread is
59	  waken up periodically (see LOG_PROCESS_THREAD_SLEEP_MS) and whenever
60	  number of buffered messages exceeds the threshold (see
61	  LOG_PROCESS_TRIGGER_THR).
62
63if LOG_PROCESS_THREAD
64
65config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
66	int "Set log processing thread startup delay"
67	default 0
68	help
69	  Log processing thread starts after requested delay given in
70	  milliseconds. When started, thread process any buffered messages.
71
72config LOG_PROCESS_THREAD_SLEEP_MS
73	int "Set internal log processing thread sleep period"
74	default 1000
75	help
76	  Log processing thread sleeps for requested period given in
77	  milliseconds. When waken up, thread process any buffered messages.
78
79config LOG_PROCESS_THREAD_STACK_SIZE
80	int "Stack size for the internal log processing thread"
81	default 4096 if (X86 && X86_64)
82	default 4096 if ARM64
83	default 4096 if (ARC && 64BIT)
84	default 4096 if SPARC
85	default 2048 if COVERAGE_GCOV
86	default 2048 if (RISCV && 64BIT)
87	default 2048 if LOG_BACKEND_FS
88	default 1152 if LOG_BACKEND_NET
89	default 4096 if NO_OPTIMIZATIONS
90	default 1024 if XTENSA
91	default 2048 if ASSERT || SPIN_VALIDATE
92	default 768
93	help
94	  Set the internal stack size for log processing thread.
95
96config LOG_PROCESSING_LATENCY_US
97	int "Maximum remote message latency (in microseconds)"
98	default 100000
99	depends on LOG_MULTIDOMAIN
100	help
101	  Arbitrary time between log message creation in the remote domain and
102	  processing in the local domain. Higher value increases message processing
103	  latency but increases chances of maintaining correct ordering of the
104	  messages. Option is used only if links are using dedicated buffers
105	  for remote messages.
106
107config LOG_PROCESS_THREAD_CUSTOM_PRIORITY
108	bool "Custom log thread priority"
109	help
110	  Set a custom value for the log processing thread.
111
112config LOG_PROCESS_THREAD_PRIORITY
113	int "Priority of the log processing thread"
114	default 0
115	depends on LOG_PROCESS_THREAD_CUSTOM_PRIORITY
116	help
117	  The priority of the log processing thread.
118	  When not set the prority is set to K_LOWEST_APPLICATION_THREAD_PRIO.
119
120endif # LOG_PROCESS_THREAD
121
122config LOG_BUFFER_SIZE
123	int "Number of bytes dedicated for the logger internal buffer"
124	default 1024
125	range 128 65536
126	help
127	  Number of bytes dedicated for the logger internal buffer.
128
129endif # LOG_MODE_DEFERRED && !LOG_FRONTEND_ONLY
130
131if LOG_MULTIDOMAIN
132
133config LOG_DOMAIN_NAME_CACHE_ENTRY_SIZE
134	int "Cache slot size of domain name"
135	default 8
136
137config LOG_DOMAIN_NAME_CACHE_ENTRY_COUNT
138	int "Number of entries in domain name cache"
139	default 2
140
141config LOG_SOURCE_NAME_CACHE_ENTRY_SIZE
142	int "Cache slot size of source name"
143	default 16
144
145config LOG_SOURCE_NAME_CACHE_ENTRY_COUNT
146	int "Number of entries in source name cache"
147	default 8
148
149endif # LOG_MULTIDOMAIN
150
151config LOG_TRACE_SHORT_TIMESTAMP
152	bool "Use 24 bit timestamp for tracing"
153	default y
154	help
155	  When enabled, shorter timestamp is used and trace message is
156	  compressed.
157
158config LOG_TIMESTAMP_64BIT
159	bool "Use 64 bit timestamp"
160
161config LOG_SPEED
162	bool "Prefer performance over size"
163	depends on LOG_MODE_DEFERRED
164	depends on !LOG_FRONTEND
165	help
166	  If enabled, logging may take more code size to get faster logging.
167
168endif # !LOG_MODE_MINIMAL
169
170endmenu
171