def plot_capacity(cpu):
     try:
         df = self.df_cpus_signal('capacity', cpus=[cpu])
     except MissingTraceEventError:
         return _hv_neutral()
     else:
         if df.empty:
             return _hv_neutral()
         else:
             return plot_signal(series_refit_index(df['capacity'],
                                                   window=window),
                                name='capacity')
Beispiel #2
0
        def plot_bands(df, column, label):
            df = df_refit_index(df, window=self.trace.window)
            if df.empty:
                return _hv_neutral()

            return hv.Overlay(
                [
                    hv.VSpan(
                        start,
                        start + duration,
                        label=label,
                    ).options(
                        alpha=0.5,
                    )
                    for start, duration in df[[column]].itertuples()
                ]
            )
Beispiel #3
0
    def plot_cpu_frequency_transitions(self,
                                       cpu: CPU,
                                       pct: bool = False,
                                       domain_label: bool = False):
        """
        Plot frequency transitions count of the specified CPU

        :param cpu: The CPU to genererate the plot for
        :type cpu: int

        :param pct: Plot frequency transitions in percentage
        :type pct: bool

        :param domain_label: If ``True``, the labels will mention all CPUs in
            the domain, rather than the CPU passed.
        :type domain_label: bool
        """

        df = self.df_cpu_frequency_transitions(cpu)

        if pct:
            df = df * 100 / df.sum()

        ylabel = 'Transitions share (%)' if pct else 'Transition count'

        if domain_label:
            domains = self.trace.plat_info['freq-domains']
            rev_domains = {
                cpu: sorted(domain)
                for domain in domains for cpu in domain
            }
            name = ', '.join(map(str, rev_domains[cpu]))
            title = f'Frequency transitions of CPUs {name}'
        else:
            title = f'Frequency transitions of CPU{cpu}'

        if not df.empty:
            return hv.Bars(df['transitions']).options(
                title=title,
                xlabel='Frequency (Hz)',
                ylabel=ylabel,
                invert_axes=True,
            )
        else:
            return _hv_neutral()
Beispiel #4
0
    def plot_overutilized(self):
        """
        Draw the system's overutilized status as colored bands
        """
        df = self.df_overutilized()
        if not df.empty:
            df = df_refit_index(df, window=self.trace.window)

            # Compute intervals in which the system is reported to be overutilized
            return hv.Overlay([
                hv.VSpan(start, start + delta, label='Overutilized').options(
                    color='red',
                    alpha=0.05,
                ) for start, delta, overutilized in df[
                    ['len', 'overutilized']].itertuples() if overutilized
            ]).options(title='System-wide overutilized status')
        else:
            return _hv_neutral()
Beispiel #5
0
        def plot_residency():
            if "freq-domains" in self.trace.plat_info:
                # If we are aware of frequency domains, use one color per domain
                for domain in self.trace.plat_info["freq-domains"]:
                    series = sw_df[sw_df["__cpu"].isin(domain)]["__cpu"]
                    series = series_refit_index(series, window=self.trace.window)

                    if series.empty:
                        return _hv_neutral()
                    else:
                        return self._plot_markers(
                            series,
                            label=f"Task running in domain {domain}"
                        )
            else:
                self._plot_markers(
                    series_refit_index(sw_df['__cpu'], window=self.trace.window)
                )
Beispiel #6
0
 def _plot_overutilized(self):
     try:
         return self.ana.status.plot_overutilized()
     except MissingTraceEventError:
         return _hv_neutral()