summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-03-27 16:22:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-03-27 16:22:12 -0700
commit744fab2d9ff9177a27647c3710e86d43f2efe68c (patch)
treebff7a2344ed1d607db4d7ec876f843c87c2bf817 /scripts
parent88221ac0d560700b50493aedc768f728aa585141 (diff)
parente0344f9564f5847dc20e245fbea67a4b262ee659 (diff)
Merge tag 'trace-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing updates from Steven Rostedt: - Add option traceoff_after_boot In order to debug kernel boot, it sometimes is helpful to enable tracing via the kernel command line. Unfortunately, by the time the login prompt appears, the trace is overwritten by the init process and other user space start up applications. Adding a "traceoff_after_boot" will disable tracing when the kernel passes control to init which will allow developers to be able to see the traces that occurred during boot. - Clean up the mmflags macros that display the GFP flags in trace events The macros to print the GFP flags for trace events had a bit of duplication. The code was restructured to remove duplication and in the process it also adds some flags that were missed before. - Removed some dead code and scripts/draw_functrace.py draw_functrace.py hasn't worked in years and as nobody complained about it, remove it. - Constify struct event_trigger_ops The event_trigger_ops is just a structure that has function pointers that are assigned when the variables are created. These variables should all be constants. - Other minor clean ups and fixes * tag 'trace-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing: Replace strncpy with memcpy for fixed-length substring copy tracing: Fix synth event printk format for str fields tracing: Do not use PERF enums when perf is not defined tracing: Ensure module defining synth event cannot be unloaded while tracing tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER tracing/osnoise: Fix possible recursive locking for cpus_read_lock() tracing: Align synth event print fmt tracing: gfp: vsprintf: Do not print "none" when using %pGg printf format tracepoint: Print the function symbol when tracepoint_debug is set tracing: Constify struct event_trigger_ops scripts/tracing: Remove scripts/tracing/draw_functrace.py tracing: Update MAINTAINERS file to include tracepoint.c tracing/user_events: Slightly simplify user_seq_show() tracing/user_events: Don't use %pK through printk tracing: gfp: Remove duplication of recording GFP flags tracing: Remove orphaned event_trace_printk ring-buffer: Fix typo in comment about header page pointer tracing: Add traceoff_after_boot option
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/tracing/draw_functrace.py129
1 files changed, 0 insertions, 129 deletions
diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
deleted file mode 100755
index 42fa87300941..000000000000
--- a/scripts/tracing/draw_functrace.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env python
-# SPDX-License-Identifier: GPL-2.0-only
-
-"""
-Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
-
-This script parses a trace provided by the function tracer in
-kernel/trace/trace_functions.c
-The resulted trace is processed into a tree to produce a more human
-view of the call stack by drawing textual but hierarchical tree of
-calls. Only the functions's names and the call time are provided.
-
-Usage:
- Be sure that you have CONFIG_FUNCTION_TRACER
- # mount -t tracefs nodev /sys/kernel/tracing
- # echo function > /sys/kernel/tracing/current_tracer
- $ cat /sys/kernel/tracing/trace_pipe > ~/raw_trace_func
- Wait some times but not too much, the script is a bit slow.
- Break the pipe (Ctrl + Z)
- $ scripts/tracing/draw_functrace.py < ~/raw_trace_func > draw_functrace
- Then you have your drawn trace in draw_functrace
-"""
-
-
-import sys, re
-
-class CallTree:
- """ This class provides a tree representation of the functions
- call stack. If a function has no parent in the kernel (interrupt,
- syscall, kernel thread...) then it is attached to a virtual parent
- called ROOT.
- """
- ROOT = None
-
- def __init__(self, func, time = None, parent = None):
- self._func = func
- self._time = time
- if parent is None:
- self._parent = CallTree.ROOT
- else:
- self._parent = parent
- self._children = []
-
- def calls(self, func, calltime):
- """ If a function calls another one, call this method to insert it
- into the tree at the appropriate place.
- @return: A reference to the newly created child node.
- """
- child = CallTree(func, calltime, self)
- self._children.append(child)
- return child
-
- def getParent(self, func):
- """ Retrieve the last parent of the current node that
- has the name given by func. If this function is not
- on a parent, then create it as new child of root
- @return: A reference to the parent.
- """
- tree = self
- while tree != CallTree.ROOT and tree._func != func:
- tree = tree._parent
- if tree == CallTree.ROOT:
- child = CallTree.ROOT.calls(func, None)
- return child
- return tree
-
- def __repr__(self):
- return self.__toString("", True)
-
- def __toString(self, branch, lastChild):
- if self._time is not None:
- s = "%s----%s (%s)\n" % (branch, self._func, self._time)
- else:
- s = "%s----%s\n" % (branch, self._func)
-
- i = 0
- if lastChild:
- branch = branch[:-1] + " "
- while i < len(self._children):
- if i != len(self._children) - 1:
- s += "%s" % self._children[i].__toString(branch +\
- " |", False)
- else:
- s += "%s" % self._children[i].__toString(branch +\
- " |", True)
- i += 1
- return s
-
-class BrokenLineException(Exception):
- """If the last line is not complete because of the pipe breakage,
- we want to stop the processing and ignore this line.
- """
- pass
-
-class CommentLineException(Exception):
- """ If the line is a comment (as in the beginning of the trace file),
- just ignore it.
- """
- pass
-
-
-def parseLine(line):
- line = line.strip()
- if line.startswith("#"):
- raise CommentLineException
- m = re.match("[^]]+?\\] +([a-z.]+) +([0-9.]+): (\\w+) <-(\\w+)", line)
- if m is None:
- raise BrokenLineException
- return (m.group(2), m.group(3), m.group(4))
-
-
-def main():
- CallTree.ROOT = CallTree("Root (Nowhere)", None, None)
- tree = CallTree.ROOT
-
- for line in sys.stdin:
- try:
- calltime, callee, caller = parseLine(line)
- except BrokenLineException:
- break
- except CommentLineException:
- continue
- tree = tree.getParent(caller)
- tree = tree.calls(callee, calltime)
-
- print(CallTree.ROOT)
-
-if __name__ == "__main__":
- main()