lisa.analysis.functions.JSONStatsFunctionsAnalysis#
- class lisa.analysis.functions.JSONStatsFunctionsAnalysis(stats_path)[source]#
Bases:
AnalysisHelpers
Support for kernel functions profiling and analysis
- Parameters:
stats_path (str) – Path to JSON function stats as returned by devlib
devlib.collector.ftrace.FtraceCollector.get_stats()
Attributes
Name of the analysis class.
Properties
logger
inheritedConvenience short-hand for
self.get_logger()
.Methods
Get a DataFrame of specified kernel functions profile data.
Return the default path to use to save plots for the analysis.
Plot functions profiling metrics for the specified kernel functions.
get_logger()
inheritedProvides a
logging.Logger
named aftercls
.get_plot_methods()
inheritedlog_locals()
inheritedDebugging aid: log the local variables of the calling function.
plot_method()
inheritedPlot function decorator.
save_plot()
inheritedSave a holoviews element or
matplotlib.figure.Figure
as an image file.
Attributes#
- JSONStatsFunctionsAnalysis.name = 'functions_json'#
Name of the analysis class.
Properties#
- property JSONStatsFunctionsAnalysis.logger#
Inherited property, see
lisa.utils.Loggable.logger
Convenience short-hand for
self.get_logger()
.
Methods#
- JSONStatsFunctionsAnalysis.df_functions_stats(functions=None, *, df_fmt=None)[source]#
Called on
Trace
instances astrace.ana.functions_json.df_functions_stats()
Get a DataFrame of specified kernel functions profile data
For each profiled function a DataFrame is returned which reports stats on kernel functions execution time. The reported stats are per-CPU and includes: number of times the function has been executed (hits), average execution time (avg), overall execution time (time) and samples variance (s_2). By default returns a DataFrame of all the functions profiled.
Added by
lisa.analysis.base.TraceAnalysisBase.df_method()
:- Parameters:
df_fmt (str or None) –
Format of dataframe to return. One of:
"pandas"
:pandas.DataFrame
"polars-lazyframe"
:polars.LazyFrame
- Returns:
The return type is determined by the dataframe format chosen for the trace object.
- JSONStatsFunctionsAnalysis.get_default_plot_path(**kwargs)[source]#
Called on
Trace
instances astrace.ana.functions_json.get_default_plot_path()
Return the default path to use to save plots for the analysis.
- JSONStatsFunctionsAnalysis.plot_profiling_stats(functions: str = None, metrics: str = 'avg', *, filepath=None, output='holoviews', img_format=None, always_save=False, backend=None, _compat_render=False, link_dataframes=None, cursor_delta=None, width=None, height=None, rc_params=None, axis=None, interactive=None, colors: Sequence[str] = None, linestyles: Sequence[str] = None, markers: Sequence[str] = None, **kwargs)[source]#
Called on
Trace
instances astrace.ana.functions_json.plot_profiling_stats()
Plot functions profiling metrics for the specified kernel functions.
For each speficied metric a barplot is generated which report the value of the metric when the kernel function has been executed on each CPU. By default all the kernel functions are plotted.
- Parameters:
Added by
lisa.analysis.base.AnalysisHelpers.plot_method()
:- Returns:
The return type is determined by the
output
parameter.- Parameters:
backend (str or None) –
Holoviews plot library backend to use:
bokeh
: good support for interactive plotsmatplotlib
: sometimes better static image output, but unpredictable results that more often than not require a fair amount of hacks to get something good.plotly
: not supported by LISA but technically available. Since it’s very similar to bokeh feature-wise, bokeh should be preferred.
Note
In a notebook, the way to choose which backend should be used to display plots is typically selected with e.g.
holoviews.extension('bokeh')
at the beginning of the notebook. Thebackend
parameter is more intended for expert use where an object of the given library is required, without depending on the environment.link_dataframes (list(pandas.DataFrame) or None) – Gated by
output="ui"
. List of dataframes to display under the figure, which is dynamically linked with it: clicking on the plot will scroll in the dataframes and vice versa.filepath (str or None) – Path of the file to save the figure in. If None, no file is saved.
always_save (bool) – When
True
, the plot is always saved even if nofilepath
has explicitly been set. In that case, a default path will be used.img_format (str) – The image format to generate. Defaults to using filepath to guess the type, or “png” if no filepath is given. html and rst are supported in addition to matplotlib image formats.
output (str or None) –
Change the return value of the method:
None
: Equivalent toholoviews
for now. In the future, this will be eitherholoviews
orui
if used in an interactive jupyter notebook.holoviews
: a bare holoviews element.render
: a backend-specific object, such asmatplotlib.figure.Figure
ifbackend='matplotlib'
html
: HTML documentrst
: a snippet of reStructuredTextui
: Pseudo holoviews figure, enriched with extra controls.Note
No assumption must be made on the return type other than that it can be displayed in a notebook cell output (and with
IPython.display.display()
). The public API holoviews is implemented in a best-effort approach, so that.options()
and.opts()
will work, but compositions using e.g.x * y
will not work ifx
is a holoviews element.In the midterm, the output type will be changed so that it is a real holoviews object, rather than some sort of proxy.
List of color names to use for the plots.
Deprecated since version 2.0: This parameter is deprecated, use holoviews APIs to set matplotlib options.
linestyles (list(str) or None) –
List of linestyle to use for the plots.
Deprecated since version 2.0: This parameter is deprecated, use holoviews APIs to set matplotlib options.
List of marker to use for the plots.
Deprecated since version 2.0: This parameter is deprecated, use holoviews APIs to set matplotlib options.
axis (matplotlib.axes.Axes or numpy.ndarray(matplotlib.axes.Axes) or None) –
instance of
matplotlib.axes.Axes
to plot into. If None, a new figure and axis are created and returned.Deprecated since version 2.0: This parameter is deprecated, use holoviews APIs to compose plot elements: http://holoviews.org/user_guide/Composing_Elements.html
rc_params (dict(str, object) or None) –
Matplotlib rc params dictionary overlaid on existing settings.
Deprecated since version 2.0: This parameter is deprecated, use holoviews APIs to set matplotlib options.
_compat_render (bool) – Internal parameter not to be used. This enables the compatibility mode where
render=True
by default when matplotlib is the current holoviews backend.
- classmethod JSONStatsFunctionsAnalysis.get_logger(suffix=None)#
Inherited method, see
lisa.utils.Loggable.get_logger()
Provides a
logging.Logger
named aftercls
.
- classmethod JSONStatsFunctionsAnalysis.get_plot_methods(*args, **kwargs)#
Inherited method, see
lisa.analysis.base.AnalysisHelpers.get_plot_methods()
- classmethod JSONStatsFunctionsAnalysis.log_locals(var_names=None, level='debug')#
Inherited method, see
lisa.utils.Loggable.log_locals()
Debugging aid: log the local variables of the calling function.
- classmethod JSONStatsFunctionsAnalysis.plot_method(f)#
Inherited method, see
lisa.analysis.base.AnalysisHelpers.plot_method()
Plot function decorator.
- JSONStatsFunctionsAnalysis.save_plot(figure, filepath=None, img_format=None, backend=None)#
Inherited method, see
lisa.analysis.base.AnalysisHelpers.save_plot()
Save a holoviews element or
matplotlib.figure.Figure
as an image file.