1/8 LTT for 2.5.34: Core infrastructure
PATCH 1/1 1/8 LTT for 2.5.34: Core infrastructure
Thanks to Francois Romieux for his constructive criticism of my previous patch. The following modifications have been made:
- indenting of trace_real_syscall_entry() corrected (See arch patches).
- function headers now use docbook style headers.
- indenting and formatting of function prototypes in trace.h corrected.
- added helper in trace.c to ease readability.
D: The core tracing infrastructure serves as the main rallying point for
D: all the tracing activity in the kernel. (Tracing here isn't meant in
D: the ptrace sense, but in the sense of recording key kernel events along
D: with a time-stamp in order to reconstruct the system's behavior post-
D: mortem.) Whether the trace driver (which buffers the data collected
D: and provides it to the user-space trace daemon via a char dev) is loaded
D: or not, the kernel sees a unique tracing function: trace_event().
D: Basically, this provides a trace driver register/unregister service.
D: When a trace driver registers, it is forwarded all the events generated
D: by the kernel. If no trace driver is registered, then the events go
D: nowhere.
D:
D: In addition to these basic services, this patch allows kernel modules
D: to allocate and trace their own custom events. Hence, a driver can
D: create its own set of events and log them part of the kernel trace.
D: Many existing drivers who go a long way in writing their own trace
D: driver and implementing their own tracing mechanism should actually
D: be using this custom event creation interface. And again, whether the
D: trace driver is active or even present makes little difference for
D: the users of the kernel's tracing infrastructure.
This is the core code for the mechanisms provided by LTT. This patch adds 2 files:kernel/trace.cinclude/linux/trace.h
Also, kernel/Makefile is modified consequently.
The complete patch is available in one piece here:
http://opersys.com/ftp/pub/LTT/ExtraPatches/patch-ltt-linux-2.5.34-vanilla-020909-1.14.bz2
The userspace tools are available here:
http://www.opersys.com/LTT
kernel/Makefile +5 -1
@@ -10,7 +10,7 @@ O_TARGET := kernel.o export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o \ - printk.o platform.o suspend.o dma.o + printk.o platform.o suspend.o dma.o trace.o obj-y = sched.o fork.o exec_domain.o panic.o printk.o \ module.o exit.o itimer.o time.o softirq.o resource.o \
@@ -32,6 +32,10 @@ # I turn this off for IA-64 only. Andreas Schwab says it's also needed on m68k # to get a correct value for the wait-channel (WCHAN in ps). --davidm CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer +endif + +ifdef CONFIG_TRACE +obj-y += trace.o endif include $(TOPDIR)/Rules.make
include/linux/trace.h +450 -0
450 lines not on this page · raw message
kernel/trace.c +634 -0
634 lines not on this page · raw message
Quoted 1 line · Karim Yaghmour
Thanks to Francois Romieux for his constructive criticism of my previous
^ Oops, typo; there's no "X".
Karim
===================================================
Karim Yaghmour
[email protected]
Embedded and Real-Time Linux Expert
===================================================
kernel/Makefile line 39
Quoted 3 lines · Karim Yaghmour
kernel/Makefile +2
-0+ifdef CONFIG_TRACE +obj-y += trace.o endif
This is still bogus.
The day that CONFIG_TRACE equals n you will still include trace.o. An explicit test for m or y is preferable.
On the other hand there is a lot of places in the makefiles that gets this wrong - sigh.
Sam
Quoted 7 lines · Sam Ravnborg
kernel/Makefile line 39
Quoted 3 lines · Karim Yaghmour
kernel/Makefile +2
-0+ifdef CONFIG_TRACE +obj-y += trace.o endifThis is still bogus.
The day thatCONFIG_TRACEequals n you will still include trace.o. An explicit test for m or y is preferable.
Thanks, I will make the appropriate changes.
Karim
===================================================
Karim Yaghmour
[email protected]
Embedded and Real-Time Linux Expert
===================================================