From 72be3d01f817b7c5c00fd8820c848c4b245a0876 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Tue, 26 Nov 2019 17:43:18 +0000 Subject: [PATCH] trace/ftrace: Only require CONFIG_FUNCTION_PROFILER for the function profiling We currently raise an exception when trying to use the 'function' or 'function_graph' tracer if the kernel wasn't compiled CONFIG_FUNCTION_PROFILER, but that is a completely valid use. --- devlib/trace/ftrace.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/devlib/trace/ftrace.py b/devlib/trace/ftrace.py index 5568243..c258b3e 100644 --- a/devlib/trace/ftrace.py +++ b/devlib/trace/ftrace.py @@ -161,9 +161,6 @@ class FtraceCollector(TraceCollector): # Check for function tracing support if self.functions: - if not self.target.file_exists(self.function_profile_file): - raise TargetStableError('Function profiling not supported. '\ - 'A kernel build with CONFIG_FUNCTION_PROFILER enable is required') # Validate required functions to be traced available_functions = self.target.execute( 'cat {}'.format(self.available_functions_file), @@ -178,7 +175,11 @@ class FtraceCollector(TraceCollector): else: selected_functions.append(function) + # Function profiling if self.tracer is None: + if not self.target.file_exists(self.function_profile_file): + raise TargetStableError('Function profiling not supported. '\ + 'A kernel build with CONFIG_FUNCTION_PROFILER enable is required') self.function_string = _build_trace_functions(selected_functions) # If function profiling is enabled we always need at least one event. # Thus, if not other events have been specified, try to add at least