def plot_tasks_forks(self, target_cpus: TypedList[CPU]=None, window: float=0.01, per_sec: bool=False, axis=None, local_fig=None): """ Plot task forks over time :param target_cpus: :type target_cpus: :param window: The rolling window size for fork counts. :type window: float :param per_sec: Display wakeups per second if True, else wakeup counts within the window :type per_sec: bool """ df = self.trace.df_event("sched_wakeup_new") if target_cpus: df = df[df.target_cpu.isin(target_cpus)] series = series_rolling_apply(df["target_cpu"], lambda x: x.count() / (window if per_sec else 1), window, window_float_index=False, center=True) series = series_refit_index(series, window=self.trace.window) series.plot(ax=axis, legend=False) if per_sec: axis.set_title("Number of task forks per second ({}s windows)".format(window)) else: axis.set_title("Number of task forks within {}s windows".format(window))
def _plot_tasks_X(self, event, name, target_cpus, window, per_sec): df = self.trace.df_event(event) if target_cpus: df = df[df['target_cpu'].isin(target_cpus)] series = series_rolling_apply( df["target_cpu"], lambda x: x.count() / (window if per_sec else 1), window, window_float_index=False, center=True ) if per_sec: label = f"Number of task {name} per second ({window}s windows)" else: label = f"Number of task {name} within {window}s windows" series = series_refit_index(series, window=self.trace.window) series.name = name return plot_signal(series, name=label)