Exemple #1
0
    def __init__(self, cgroup_path: str, platform_cpus: int,
                 platform_sockets: int,
                 rdt_information: Optional[RDTInformation],
                 resgroup: ResGroup = None,
                 allocation_configuration:
                 Optional[AllocationConfiguration] = None,
                 event_names: List[str] = None,
                 enable_derived_metrics: bool = False):
        self._cgroup_path = cgroup_path
        self._name = _sanitize_cgroup_path(self._cgroup_path)
        assert len(self._name) > 0, 'Container name cannot be empty string!'
        self._allocation_configuration = allocation_configuration
        self._rdt_information = rdt_information
        self._resgroup = resgroup
        self._event_names = event_names

        self._cgroup = cgroups.Cgroup(
            cgroup_path=self._cgroup_path,
            platform_cpus=platform_cpus,
            platform_sockets=platform_sockets,
            allocation_configuration=allocation_configuration)

        self._derived_metrics_generator = None
        if self._event_names:
            self._perf_counters = perf.PerfCounters(self._cgroup_path, event_names=event_names)
            if enable_derived_metrics:
                self._derived_metrics_generator = DerivedMetricsGenerator(
                    event_names, self._perf_counters.get_measurements)
Exemple #2
0
    def __init__(self,
                 cgroup_path: str, cgroup_paths: List[str], platform_cpus: int,
                 platform_sockets: int,
                 rdt_information: Optional[RDTInformation],
                 allocation_configuration: Optional[AllocationConfiguration] = None,
                 resgroup: ResGroup = None,
                 event_names: List[str] = None,
                 enable_derived_metrics: bool = False
                 ):
        self._cgroup_path = cgroup_path
        self._name = _sanitize_cgroup_path(self._cgroup_path)
        self._allocation_configuration = allocation_configuration

        self._rdt_information = rdt_information
        self._resgroup = resgroup

        # Create Cgroup object representing itself.
        self._cgroup = cgroups.Cgroup(
            cgroup_path=self._cgroup_path,
            platform_cpus=platform_cpus,
            platform_sockets=platform_sockets,
            allocation_configuration=allocation_configuration)

        # Create Cgroup objects for children.
        self._subcontainers: Dict[str, Container] = {}
        for cgroup_path in cgroup_paths:
            self._subcontainers[cgroup_path] = Container(
                cgroup_path=cgroup_path,
                rdt_information=None,
                platform_cpus=platform_cpus,
                platform_sockets=platform_sockets,
                allocation_configuration=allocation_configuration,
                event_names=event_names,
                enable_derived_metrics=enable_derived_metrics,
            )
Exemple #3
0
    def __init__(
        self,
        cgroup_path: str,
        platform: Platform,
        resgroup: ResGroup = None,
        allocation_configuration: Optional[AllocationConfiguration] = None,
        event_names: List[MetricName] = None,
        enable_derived_metrics: bool = False,
        wss_reset_cycles: Optional[int] = None,
        wss_stable_cycles: int = 0,
        wss_membw_threshold: Optional[float] = None,
        perf_aggregate_cpus: bool = True,
        interval: int = 5,
        sched: Union[bool, Pattern] = False,
    ):
        self._cgroup_path = cgroup_path
        self._name = _sanitize_cgroup_path(self._cgroup_path)
        assert len(self._name) > 0, 'Container name cannot be empty string!'
        self._allocation_configuration = allocation_configuration
        self._platform = platform
        self._resgroup = resgroup
        self._event_names = event_names
        self._perf_aggregate_cpus = perf_aggregate_cpus
        self._sched = sched

        self._cgroup = cgroups.Cgroup(
            cgroup_path=self._cgroup_path,
            platform=platform,
            allocation_configuration=allocation_configuration)

        if wss_reset_cycles is not None:
            log.debug(
                'Enable WSS measurments: interval=%s '
                'wss_reset_cycles=%s wss_stable_cycles=%s wss_membw_threshold=%s',
                interval, wss_reset_cycles, wss_stable_cycles,
                wss_membw_threshold)

            self.wss = wss.WSS(
                interval=interval,
                get_pids=self.get_pids,
                wss_reset_cycles=wss_reset_cycles,
                wss_stable_cycles=wss_stable_cycles,
                wss_membw_threshold=wss_membw_threshold,
            )
        else:
            self.wss = None

        self._perf_counters = None
        if self._event_names:
            self._perf_counters = perf.PerfCounters(
                self._cgroup_path,
                event_names=event_names,
                platform=platform,
                aggregate_for_all_cpus_with_sum=self._perf_aggregate_cpus,
            )

        self._derived_metrics_generator = None
        if enable_derived_metrics:
            self._derived_metrics_generator = \
                PerfCgroupDerivedMetricsGenerator(self._get_measurements)
Exemple #4
0
    def __init__(
        self,
        cgroup_path: str,
        cgroup_paths: List[str],
        platform: Platform,
        allocation_configuration: Optional[AllocationConfiguration] = None,
        resgroup: ResGroup = None,
        event_names: List[str] = None,
        enable_derived_metrics: bool = False,
        wss_reset_cycles: Optional[int] = None,
        wss_stable_cycles: int = 0,
        wss_membw_threshold: Optional[float] = None,
        perf_aggregate_cpus: bool = True,
        interval: int = 5,
        sched: Union[bool, Pattern] = False,
    ):
        self._cgroup_path = cgroup_path
        self._name = _sanitize_cgroup_path(self._cgroup_path)
        self._allocation_configuration = allocation_configuration

        self._platform = platform
        self._resgroup = resgroup
        self._perf_aggregate_cpus = perf_aggregate_cpus
        # Create Cgroup object representing itself.
        self._cgroup = cgroups.Cgroup(
            cgroup_path=self._cgroup_path,
            platform=platform,
            allocation_configuration=allocation_configuration)
        self.wss = None

        if wss_reset_cycles is not None:
            log.debug(
                'Enable WSS measurments: interval=%s '
                'wss_reset_cycles=%s wss_stable_cycles=%s wss_membw_threshold=%s',
                interval, wss_reset_cycles, wss_stable_cycles,
                wss_membw_threshold)

            self.wss = wss.WSS(
                interval=interval,
                get_pids=self.get_pids,
                wss_reset_cycles=wss_reset_cycles,
                wss_stable_cycles=wss_stable_cycles,
                wss_membw_threshold=wss_membw_threshold,
            )
        else:
            self.wss = None

        # Create Cgroup objects for children.
        self._subcontainers: Dict[str, Container] = {}
        for cgroup_path in cgroup_paths:
            self._subcontainers[cgroup_path] = Container(
                cgroup_path=cgroup_path,
                platform=platform,
                allocation_configuration=allocation_configuration,
                event_names=event_names,
                enable_derived_metrics=enable_derived_metrics,
                perf_aggregate_cpus=perf_aggregate_cpus,
                interval=interval,
                sched=sched,
            )
    def __init__(
            self,
            cgroup_path: str,
            cgroup_paths: List[str],
            platform: Platform,
            allocation_configuration: Optional[AllocationConfiguration] = None,
            resgroup: ResGroup = None,
            event_names: List[str] = None,
            enable_derived_metrics: bool = False,
            wss_reset_interval: int = 0,
            perf_aggregate_cpus: bool = True):
        self._cgroup_path = cgroup_path
        self._name = _sanitize_cgroup_path(self._cgroup_path)
        self._allocation_configuration = allocation_configuration

        self._platform = platform
        self._resgroup = resgroup
        self._perf_aggregate_cpus = perf_aggregate_cpus
        # Create Cgroup object representing itself.
        self._cgroup = cgroups.Cgroup(
            cgroup_path=self._cgroup_path,
            platform=platform,
            allocation_configuration=allocation_configuration)

        # Create Cgroup objects for children.
        self._subcontainers: Dict[str, Container] = {}
        for cgroup_path in cgroup_paths:
            self._subcontainers[cgroup_path] = Container(
                cgroup_path=cgroup_path,
                platform=platform,
                allocation_configuration=allocation_configuration,
                event_names=event_names,
                enable_derived_metrics=enable_derived_metrics,
                wss_reset_interval=wss_reset_interval,
                perf_aggregate_cpus=perf_aggregate_cpus)
Exemple #6
0
    def __init__(
            self,
            cgroup_path: str,
            platform: Platform,
            resgroup: ResGroup = None,
            allocation_configuration: Optional[AllocationConfiguration] = None,
            event_names: List[MetricName] = None,
            enable_derived_metrics: bool = False,
            wss_reset_interval: int = 0,
            wss_stable_duration: int = 30,
            wss_threshold_divider: int = 100,
            perf_aggregate_cpus: bool = True,
            interval: int = 5):
        self._cgroup_path = cgroup_path
        self._name = _sanitize_cgroup_path(self._cgroup_path)
        assert len(self._name) > 0, 'Container name cannot be empty string!'
        self._allocation_configuration = allocation_configuration
        self._platform = platform
        self._resgroup = resgroup
        self._event_names = event_names
        self._perf_aggregate_cpus = perf_aggregate_cpus
        self.parent_measurements = None

        self._cgroup = cgroups.Cgroup(
            cgroup_path=self._cgroup_path,
            platform=platform,
            allocation_configuration=allocation_configuration)

        if wss_reset_interval != 0:
            self.wss = wss.WSS(
                interval=interval,
                get_pids=self.get_pids,
                wss_reset_interval=wss_reset_interval,
                wss_stable_duration=wss_stable_duration,
                wss_threshold_divider=wss_threshold_divider,
            )
        else:
            self.wss = None

        self._perf_counters = None
        if self._event_names:
            self._perf_counters = perf.PerfCounters(
                self._cgroup_path,
                event_names=event_names,
                platform=platform,
                aggregate_for_all_cpus_with_sum=self._perf_aggregate_cpus,
            )

        self._derived_metrics_generator = None
        if enable_derived_metrics:
            self._derived_metrics_generator = \
                PerfCgroupDerivedMetricsGenerator(self._get_measurements)