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