Make --trace an option of each subcommand rather than an option that comes before the subcommand.
See !2249 (merged) for some details of what is available, particularly:
The dataframe you get will differ from what you would get with pandas if you use trace.df_event(window=...) or trace slices, due to a change of the defaults for df_event(signals=...) parameter when df_fmt='polars-lazyframe' is used. You now need to provide your own signals. This was done to put all events on the same footing and not require any event-specific support in LISA.
You can mimic that with the appropriate signals: https://gitlab.arm.com/tooling/lisa/-/blob/main/lisa/analysis/tasks.py?ref_type=heads#L657
If you don't, you'll probably end up with a broken plot when trace slicing/windowing is used.
I don't have strong feelings but I think you can use the keyword argument syntax here to shorten :
.with_columns(active=0, name="")
When you move to using LazyFrame returned by df_event(), the "Time" column will have a pl.Duration()
dtype. Using this, you can use pl.col('duration').dt.total_microseconds() to convert to a duration in microseconds
updating a dict while iterating on it is a bad idea. You can build it right directly:
d_irq_stats = {
k: v[0]
for k, v in irq_stats.to_dict(as_series=False)
}
You'll probably need to re-test the output once you use `TraceAnalysisBase.plot_method` decorator, as it changes some defaults. Maybe you won't need to do as much, or maybe you'll need to override some stuff
ditto on indentation
using to_pandas() is probably going to be faster than to_dict() if there is a non-negligible amount of data.
s/=/= /
wild indentation, this should be indented 4 spaces more than irq_stats =
as per PEP8, spaces around operators
That's usually a very bad idea, it's very likely the code can be refactored so that here you can just use group_by() on a LazyFrame that contains all the info returned by another helper. That other helper would also be used to implement df_irq_handler()
(with a filter applied on it instead of a group_by) or something like that
Either the method returns a dataframe (in which case it needs the TraceAnalysisBase.df_method decorator) or it does not, this can't be chosen dynamically like that. If you want a polars helper internally to help implementing other methods, you can put it in a private method and just make the public return the dict.
Can now be replaced by:
# Using this view will make df_event() default to returning a pl.LazyFrame, and call to other analysis methods via trace.ana will also default to a lazyframe (regardless of their internal implementation)
trace = self.trace.get_view(df_fmt='polars-lazyframe')
df_irq_entry = trace.df_event('irq_handler_entry')
You can use the new @TraceAnalysisBase.df_method
decorator. It will cache the output and deal with dataframe format conversion
GITLAB_REPO_TOKEN (f7ab6669) at 28 Mar 14:59
Autocommit to preview branch on Thu Mar 28 14:59:11 UTC 2024 tracki...
GITLAB_REPO_TOKEN (7ea7e3f6) at 28 Mar 14:59
lisa.analysis.tasks: Fix plot_tasks_activation()
... and 11 more commits
GITLAB_REPO_TOKEN (17c6185c) at 28 Mar 14:59
Autocommit to master branch on Thu Mar 28 14:59:01 UTC 2024 trackin...
GITLAB_REPO_TOKEN (19749f30) at 28 Mar 14:59
shell/lisa_shell: Add attention banner on source init_env
... and 10 more commits
Douglas Raillard (b67c7491) at 28 Mar 14:39
lisa._kmod: Do not download kernel.org tarball for rc kernels
... and 1 more commit