def _get_headroom_metrics(self, assign_cpus, lcutil, sysutil): util_max = self.analyzer.threshold['lcutilmax'] if util_max < lcutil: self.analyzer.threshold['lcutilmax'] = lcutil util_max = lcutil capacity = assign_cpus * 100 return [OwcaMetric(name=Metric.LCCAPACITY, value=capacity), OwcaMetric(name=Metric.LCMAX, value=util_max), OwcaMetric(name=Metric.SYSUTIL, value=sysutil)]
def _get_headroom_metrics(self, assign_cpus, lcutil, sysutil): util_max = self.analyzer.get_lcutilmax() if util_max < lcutil: self.analyzer.update_lcutilmax(lcutil) self.cpuc.update_max_sys_util(lcutil) util_max = lcutil capacity = assign_cpus * 100 return [ OwcaMetric(name=Metric.LCCAPACITY, value=capacity), OwcaMetric(name=Metric.LCMAX, value=util_max), OwcaMetric(name=Metric.SYSUTIL, value=sysutil) ]
def _append_metrics(self, metrics, mname, mvalue): metric = OwcaMetric( name=mname, value=mvalue, labels=dict( task_id=self.cid, ) ) metrics.append(metric)
def get_owca_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 = OwcaMetric(name=met, value=val, labels=label_dict) metrics.append(metric) return metrics
def _get_threshold_metrics(self): """Encode threshold objects as OWCA 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( OwcaMetric(name='threshold_lcutilmax', value=threshold) ) continue if 'tdp' in threshold and 'bar' in threshold['tdp']: metrics.extend([ OwcaMetric( name='threshold_tdp_bar', value=threshold['tdp']['bar'], labels=dict(cid=cid)), OwcaMetric( name='threshold_tdp_util', value=threshold['tdp']['util'], labels=dict(cid=cid)), ]) if 'thresh' in threshold: for d in threshold['thresh']: metrics.extend([ OwcaMetric( name='threshold_cpi', labels=dict(start=str(int(d['util_start'])), end=str(int(d['util_end'])), cid=cid), value=d['cpi']), OwcaMetric( name='threshold_mpki', labels=dict(start=str(int(d['util_start'])), end=str(int(d['util_end'])), cid=cid), value=(d['mpki'])), OwcaMetric( name='threshold_mb', labels=dict(start=str(int(d['util_start'])), end=str(int(d['util_end'])), cid=cid), value=(d['mb'])), ]) return metrics