Skip to content

Commit 41abcc5

Browse files
committed
tracing: move tracing under subsys/
Tracing subsystem is growing and although related to debugging, it does deserve to belong into its own subsystem. Signed-off-by: Anas Nashif <[email protected]>
1 parent 707858e commit 41abcc5

32 files changed

+185
-177
lines changed

subsys/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ add_subdirectory(fb)
1919
add_subdirectory(power)
2020
add_subdirectory(stats)
2121
add_subdirectory(testsuite)
22+
add_subdirectory(tracing)
2223
add_subdirectory_if_kconfig(jwt)
2324
add_subdirectory(canbus)

subsys/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ source "subsys/settings/Kconfig"
3535

3636
source "subsys/testsuite/Kconfig"
3737

38+
source "subsys/tracing/Kconfig"
39+
3840
source "subsys/fb/Kconfig"
3941

4042
source "subsys/jwt/Kconfig"

subsys/debug/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@ zephyr_sources_ifdef(
99
CONFIG_ASAN
1010
asan_hacks.c
1111
)
12-
13-
add_subdirectory(tracing)

subsys/debug/Kconfig

Lines changed: 0 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -39,133 +39,6 @@ config DEBUG
3939
only disables optimization, more debugging variants can be selected
4040
from here to allow more debugging.
4141

42-
config TRACING
43-
bool "Enabling Tracing"
44-
help
45-
Enable system tracing. This requires a backend such as SEGGER
46-
Systemview to be enabled as well.
47-
48-
if TRACING
49-
50-
choice
51-
prompt "Tracing Method"
52-
default TRACING_ASYNC
53-
54-
config TRACING_SYNC
55-
bool "Synchronous Tracing"
56-
select RING_BUFFER
57-
help
58-
Enable synchronous tracing. This requires the backend to be
59-
very low-latency.
60-
61-
config TRACING_ASYNC
62-
bool "Asynchronous Tracing"
63-
select RING_BUFFER
64-
help
65-
Enable asynchronous tracing. This will buffer all the tracing
66-
packets to the ring buffer first, tracing thread will try to
67-
output as much data in ring buffer as possible when tracing
68-
thread get scheduled.
69-
70-
endchoice
71-
72-
config TRACING_THREAD_STACK_SIZE
73-
int "Stack size of tracing thread"
74-
default 1024
75-
depends on TRACING_ASYNC
76-
help
77-
Stack size of tracing thread.
78-
79-
config TRACING_THREAD_WAIT_THRESHOLD
80-
int "Tracing thread waiting threshold"
81-
default 100
82-
depends on TRACING_ASYNC
83-
help
84-
Tracing thread waiting period given in milliseconds after
85-
every first packet put to tracing buffer.
86-
87-
config TRACING_BUFFER_SIZE
88-
int "Size of tracing buffer"
89-
default 2048 if TRACING_ASYNC
90-
default TRACING_PACKET_MAX_SIZE if TRACING_SYNC
91-
range 32 65536
92-
help
93-
Size of tracing buffer. If TRACING_ASYNC is enabled, tracing buffer
94-
is used as ring_buffer to buffer data packet and string packet. If
95-
TRACING_SYNC is enabled, it's used to hold the formated data.
96-
97-
config TRACING_PACKET_MAX_SIZE
98-
int "Max size of one tracing packet"
99-
default 32
100-
help
101-
Max size of one tracing packet.
102-
103-
choice
104-
prompt "Tracing Backend"
105-
default TRACING_BACKEND_UART
106-
107-
config TRACING_BACKEND_UART
108-
bool "Enable UART backend"
109-
depends on UART_CONSOLE
110-
depends on TRACING_ASYNC
111-
help
112-
When enabled backend is using UART to output tracing data.
113-
114-
config TRACING_BACKEND_USB
115-
bool "Enable USB backend"
116-
depends on TRACING_ASYNC
117-
help
118-
When enabled backend is using USB to output tracing data.
119-
120-
config TRACING_BACKEND_POSIX
121-
bool "Enable POSIX backend"
122-
depends on TRACING_SYNC
123-
depends on ARCH_POSIX
124-
help
125-
When enabled backend is using posix API to output tracing
126-
data to file system.
127-
128-
endchoice
129-
130-
config TRACING_BACKEND_UART_NAME
131-
string "Device Name of UART Device for UART backend"
132-
default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))" if HAS_DTS
133-
default "UART_0"
134-
depends on TRACING_BACKEND_UART
135-
help
136-
This option specifies the name of UART device to be used for
137-
tracing backend.
138-
139-
config TRACING_USB_MPS
140-
int "USB backend max packet size"
141-
default 64
142-
depends on TRACING_BACKEND_USB
143-
help
144-
USB tracing backend max packet size(endpoint MPS).
145-
146-
config TRACING_HANDLE_HOST_CMD
147-
bool "Enable host cmd handle"
148-
select UART_INTERRUPT_DRIVEN if TRACING_BACKEND_UART
149-
help
150-
When enabled tracing will handle cmd from host to dynamically
151-
enable and disable tracing to have host capture tracing stream
152-
data conveniently.
153-
154-
config TRACING_CMD_BUFFER_SIZE
155-
int "Size of tracing cmd buffer"
156-
default 32
157-
range 32 128
158-
help
159-
Size of tracing command buffer.
160-
161-
config TRACING_ISR
162-
bool "Enabling Tracing ISR"
163-
help
164-
Enable tracing ISR. This requires the backend to be
165-
very low-latency.
166-
167-
endif
168-
16942
config ASAN
17043
bool "Build with address sanitizer"
17144
depends on ARCH_POSIX
@@ -409,53 +282,5 @@ config OPENOCD_SUPPORT
409282
OpenOCD to determine the state of running threads. (This option
410283
selects CONFIG_THREAD_MONITOR, so all of its caveats are implied.)
411284

412-
config TRACING_CPU_STATS
413-
bool "Enable CPU usage tracing"
414-
select THREAD_MONITOR
415-
select THREAD_STACK_INFO
416-
select TRACING
417-
help
418-
Module provides information about percent of CPU usage based on
419-
tracing hooks for threads switching in and out, interrupts enters
420-
and exits (only distinguishes between idle thread, non idle thread
421-
and scheduler). Use provided API or enable automatic logging to
422-
get values.
423-
424-
config TRACING_CPU_STATS_LOG
425-
bool "Enable current CPU usage logging"
426-
depends on TRACING_CPU_STATS
427-
help
428-
Periodically displays information about CPU usage.
429-
430-
config TRACING_CPU_STATS_INTERVAL
431-
int "Logging interval for CPU measurements [ms]"
432-
default 2000
433-
depends on TRACING_CPU_STATS_LOG
434-
help
435-
Time period of displaying information about CPU usage.
436-
437-
config TRACING_CTF
438-
bool "Tracing via Common Trace Format support"
439-
select THREAD_MONITOR
440-
select TRACING
441-
help
442-
Enable tracing to a Common Trace Format stream.
443-
444-
config TRACING_CTF_TIMESTAMP
445-
bool "Enable CTF internal timestamp"
446-
default y
447-
help
448-
Timestamp prefix will be added to the beginning of CTF
449-
event internally.
450-
451-
config TRACING_TEST
452-
bool "Tracing for test usage"
453-
depends on TRACING
454-
help
455-
Enable tracing for testing kinds of format purpose. It must
456-
implement the tracing hooks defined in tracing_test.h
457-
458-
459-
source "subsys/debug/Kconfig.segger"
460285

461286
endmenu
File renamed without changes.

subsys/tracing/Kconfig

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Debug configuration options
2+
3+
# Copyright (c) 2015 Wind River Systems, Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
DT_CHOSEN_Z_CONSOLE := zephyr,console
7+
8+
config TRACING
9+
bool "Enabling Tracing"
10+
help
11+
Enable system tracing. This requires a backend such as SEGGER
12+
Systemview to be enabled as well.
13+
14+
if TRACING
15+
16+
choice
17+
prompt "Tracing Method"
18+
default TRACING_ASYNC
19+
20+
config TRACING_SYNC
21+
bool "Synchronous Tracing"
22+
select RING_BUFFER
23+
help
24+
Enable synchronous tracing. This requires the backend to be
25+
very low-latency.
26+
27+
config TRACING_ASYNC
28+
bool "Asynchronous Tracing"
29+
select RING_BUFFER
30+
help
31+
Enable asynchronous tracing. This will buffer all the tracing
32+
packets to the ring buffer first, tracing thread will try to
33+
output as much data in ring buffer as possible when tracing
34+
thread get scheduled.
35+
36+
endchoice
37+
38+
config TRACING_THREAD_STACK_SIZE
39+
int "Stack size of tracing thread"
40+
default 1024
41+
depends on TRACING_ASYNC
42+
help
43+
Stack size of tracing thread.
44+
45+
config TRACING_THREAD_WAIT_THRESHOLD
46+
int "Tracing thread waiting threshold"
47+
default 100
48+
depends on TRACING_ASYNC
49+
help
50+
Tracing thread waiting period given in milliseconds after
51+
every first packet put to tracing buffer.
52+
53+
config TRACING_BUFFER_SIZE
54+
int "Size of tracing buffer"
55+
default 2048 if TRACING_ASYNC
56+
default TRACING_PACKET_MAX_SIZE if TRACING_SYNC
57+
range 32 65536
58+
help
59+
Size of tracing buffer. If TRACING_ASYNC is enabled, tracing buffer
60+
is used as ring_buffer to buffer data packet and string packet. If
61+
TRACING_SYNC is enabled, it's used to hold the formated data.
62+
63+
config TRACING_PACKET_MAX_SIZE
64+
int "Max size of one tracing packet"
65+
default 32
66+
help
67+
Max size of one tracing packet.
68+
69+
choice
70+
prompt "Tracing Backend"
71+
default TRACING_BACKEND_UART
72+
73+
config TRACING_BACKEND_UART
74+
bool "Enable UART backend"
75+
depends on UART_CONSOLE
76+
depends on TRACING_ASYNC
77+
help
78+
When enabled backend is using UART to output tracing data.
79+
80+
config TRACING_BACKEND_USB
81+
bool "Enable USB backend"
82+
depends on TRACING_ASYNC
83+
help
84+
When enabled backend is using USB to output tracing data.
85+
86+
config TRACING_BACKEND_POSIX
87+
bool "Enable POSIX backend"
88+
depends on TRACING_SYNC
89+
depends on ARCH_POSIX
90+
help
91+
When enabled backend is using posix API to output tracing
92+
data to file system.
93+
94+
endchoice
95+
96+
config TRACING_BACKEND_UART_NAME
97+
string "Device Name of UART Device for UART backend"
98+
default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))" if HAS_DTS
99+
default "UART_0"
100+
depends on TRACING_BACKEND_UART
101+
help
102+
This option specifies the name of UART device to be used for
103+
tracing backend.
104+
105+
config TRACING_USB_MPS
106+
int "USB backend max packet size"
107+
default 64
108+
depends on TRACING_BACKEND_USB
109+
help
110+
USB tracing backend max packet size(endpoint MPS).
111+
112+
config TRACING_HANDLE_HOST_CMD
113+
bool "Enable host cmd handle"
114+
select UART_INTERRUPT_DRIVEN if TRACING_BACKEND_UART
115+
help
116+
When enabled tracing will handle cmd from host to dynamically
117+
enable and disable tracing to have host capture tracing stream
118+
data conveniently.
119+
120+
config TRACING_CMD_BUFFER_SIZE
121+
int "Size of tracing cmd buffer"
122+
default 32
123+
range 32 128
124+
help
125+
Size of tracing command buffer.
126+
127+
config TRACING_ISR
128+
bool "Enabling Tracing ISR"
129+
help
130+
Enable tracing ISR. This requires the backend to be
131+
very low-latency.
132+
133+
endif
134+
135+
config TRACING_CPU_STATS
136+
bool "Enable CPU usage tracing"
137+
select THREAD_MONITOR
138+
select THREAD_STACK_INFO
139+
select TRACING
140+
help
141+
Module provides information about percent of CPU usage based on
142+
tracing hooks for threads switching in and out, interrupts enters
143+
and exits (only distinguishes between idle thread, non idle thread
144+
and scheduler). Use provided API or enable automatic logging to
145+
get values.
146+
147+
config TRACING_CPU_STATS_LOG
148+
bool "Enable current CPU usage logging"
149+
depends on TRACING_CPU_STATS
150+
help
151+
Periodically displays information about CPU usage.
152+
153+
config TRACING_CPU_STATS_INTERVAL
154+
int "Logging interval for CPU measurements [ms]"
155+
default 2000
156+
depends on TRACING_CPU_STATS_LOG
157+
help
158+
Time period of displaying information about CPU usage.
159+
160+
config TRACING_CTF
161+
bool "Tracing via Common Trace Format support"
162+
select THREAD_MONITOR
163+
select TRACING
164+
help
165+
Enable tracing to a Common Trace Format stream.
166+
167+
config TRACING_CTF_TIMESTAMP
168+
bool "Enable CTF internal timestamp"
169+
default y
170+
help
171+
Timestamp prefix will be added to the beginning of CTF
172+
event internally.
173+
174+
config TRACING_TEST
175+
bool "Tracing for test usage"
176+
depends on TRACING
177+
help
178+
Enable tracing for testing kinds of format purpose. It must
179+
implement the tracing hooks defined in tracing_test.h
180+
181+
182+
source "subsys/tracing/Kconfig.segger"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)