Re: [PATCH v1] rtla: Save trace when option `--trace` is specified
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2025-03-03 20:03:00
Also in:
lkml
On Mon, 3 Mar 2025 16:34:21 +0100 Tomas Glozar [off-list ref] wrote:
pá 28. 2. 2025 v 2:05 odesílatel Steven Rostedt [off-list ref] napsal:quoted
Without tracing being off, this can run forever if the events come in faster than it can be recorded. And save trace uses the "trace" file, which is slow to read. Are you sure you want that?Isn't that a different problem though? As far as I'm aware, it shouldn't matter at all whether tracing is stopped on the main instance for collecting the trace from the record instance. If the record instance generates a lot of samples, this can already run forever, regardless of whether tracing is stopped on the main instance or not. This should be a separate fix.
Not sure what you mean by "main instance"?
The code being changed is:
- if (osnoise_trace_is_off(tool, record)) {
+ if (osnoise_trace_is_off(tool, record))
printf("rtla osnoise hit stop tracing\n");
- if (params->trace_output) {
- printf(" Saving trace to %s\n", params->trace_output);
- save_trace_to_file(record->trace.inst, params->trace_output);
- }
+ if (params->trace_output) {
+ printf(" Saving trace to %s\n", params->trace_output);
+ save_trace_to_file(record->trace.inst, params->trace_output);
}
Where osnoise_trace_is_off() is:
bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record)
{
/*
* The tool instance is always present, it is the one used to collect
* data.
*/
if (!tracefs_trace_is_on(tool->trace.inst))
return true;
/*
* The trace record instance is only enabled when -t is set. IOW, when the system
* is tracing.
*/
return record && !tracefs_trace_is_on(record->trace.inst);
}
Which returns true if the tool->trace.inst is on and false otherwise.
-- Steve