def _get_headroom_metrics(self, assign_cpus, lcutil, sysutil):
     util_max = self.analyzer.get_lcutilmax()
     if util_max < lcutil:
         self.analyzer.update_lcutilmax(lcutil)
         util_max = lcutil
     capacity = assign_cpus * 100
     return [
         WCAMetric(name=Metric.LCCAPACITY, value=capacity),
         WCAMetric(name=Metric.LCMAX, value=util_max),
         WCAMetric(name=Metric.SYSUTIL, value=sysutil)
     ]
Esempio n. 2
0
 def _append_metrics(self, metrics, mname, mvalue):
     metric = WCAMetric(
             name=mname,
             value=mvalue,
             labels=dict(
                 task_id=self.cid,
             )
         )
     metrics.append(metric)
    def get_wca_metrics(self, app, vcpu):
        metrics = []
        if self.metrics:
            for met, val in self.metrics.items():
                label_dict = dict(task_id=self.cid)
                if app:
                    label_dict['application'] = app
                    label_dict['initial_task_cpu_assignment'] = str(vcpu)

                metric = WCAMetric(name=met, value=val, labels=label_dict)
                metrics.append(metric)
        return metrics
Esempio n. 4
0
    def get_wca_metrics(self, app):
        metrics = []
        if self.metrics:
            for met, val in self.metrics.items():
                label_dict = dict(
                    task_id=self.cid
                )
                if app:
                    label_dict['application'] = app

                metric = WCAMetric(
                    name=met,
                    value=val,
                    labels=label_dict
                )
                metrics.append(metric)
        return metrics
Esempio n. 5
0
    def _get_threshold_metrics(self):
        """Encode threshold objects as WCA metrics.
        In contrast to *_threshold metrics from Container,
        all utilization partitions are exposed for all workloads.
        """
        metrics = []
        # Only when debugging is enabled.
        if log.getEffectiveLevel() == logging.DEBUG:
            for cid, threshold in self.analyzer.threshold.items():
                if cid == 'lcutilmax':
                    metrics.append(
                        WCAMetric(name='threshold_lcutilmax', value=threshold)
                    )
                    continue
                if 'tdp' in threshold and 'bar' in threshold['tdp']:
                    metrics.extend([
                        WCAMetric(
                            name='threshold_tdp_bar',
                            value=threshold['tdp']['bar'],
                            labels=dict(cid=cid)),
                        WCAMetric(
                            name='threshold_tdp_util',
                            value=threshold['tdp']['util'],
                            labels=dict(cid=cid)),
                    ])
                if 'thresh' in threshold:
                    for d in threshold['thresh']:
                        metrics.extend([
                            WCAMetric(
                                name='threshold_cpi',
                                labels=dict(start=str(int(d['util_start'])),
                                            end=str(int(d['util_end'])),
                                            cid=cid),
                                value=d['cpi']),
                            WCAMetric(
                                name='threshold_mpki',
                                labels=dict(start=str(int(d['util_start'])),
                                            end=str(int(d['util_end'])),
                                            cid=cid),
                                value=(d['mpki'])),
                            WCAMetric(
                                name='threshold_mb',
                                labels=dict(start=str(int(d['util_start'])),
                                            end=str(int(d['util_end'])),
                                            cid=cid),
                                value=(d['mb'])),
                        ])

        return metrics