示例#1
0
    def calibration(self, force=False):
        """
        Get rt-app calibration. Run calibration on target if necessary.

        :param force: Always run calibration on target, even if we have not
                      installed rt-app or have already run calibration.
        :returns: A dict with calibration results, which can be passed as the
                  ``calibration`` parameter to :class:`RTA`, or ``None`` if
                  force=False and we have not installed rt-app.
        """

        if not force and self._calib:
            return self._calib

        required = force or 'rt-app' in self.__installed_tools

        if not required:
            self._log.debug('No RT-App workloads, skipping calibration')
            return

        if not force and 'rtapp-calib' in self.conf:
            self._log.warning('Using configuration provided RTApp calibration')
            self._calib = {
                    int(key): int(value)
                    for key, value in self.conf['rtapp-calib'].items()
                }
        else:
            self._log.info('Calibrating RTApp...')
            self._calib = RTA.calibrate(self.target)

        self._log.info('Using RT-App calibration values:')
        self._log.info('   %s',
                       "{" + ", ".join('"%r": %r' % (key, self._calib[key])
                                       for key in sorted(self._calib)) + "}")
        return self._calib
示例#2
0
文件: env.py 项目: deggeman/lisa
    def calibration(self, force=False):

        if not force and self._calib:
            return self._calib

        required = False
        if force:
            required = True
        if 'rt-app' in self.__tools:
            required = True
        elif 'wloads' in self.conf:
            wloads = self.conf['wloads']
            for wl_idx in wloads:
                if 'rt-app' in wloads[wl_idx]['type']:
                    required = True
                    break

        if not required:
            logging.debug('No RT-App workloads, skipping calibration')
            return

        if not force and 'rtapp-calib' in self.conf:
            logging.info('Loading RTApp calibration from configuration file...')
            self._calib = {
                    int(key): int(value)
                    for key, value in self.conf['rtapp-calib'].items()
                }
        else:
            logging.info('Calibrating RTApp...')
            self._calib = RTA.calibrate(self.target)

        logging.info('Using RT-App calibration values: %s',
                "{" + ", ".join('"%r": %r' % (key, self._calib[key])
                                for key in sorted(self._calib)) + "}")
        return self._calib
示例#3
0
文件: env.py 项目: credp/lisa
    def calibration(self, force=False):
        """
        Get rt-app calibration. Run calibration on target if necessary.

        :param force: Always run calibration on target, even if we have not
                      installed rt-app or have already run calibration.
        :returns: A dict with calibration results, which can be passed as the
                  ``calibration`` parameter to :class:`RTA`, or ``None`` if
                  force=False and we have not installed rt-app.
        """

        if not force and self._calib:
            return self._calib

        required = force or 'rt-app' in self.__installed_tools

        if not required:
            self._log.debug('No RT-App workloads, skipping calibration')
            return

        if not force and 'rtapp-calib' in self.conf:
            self._log.warning('Using configuration provided RTApp calibration')
            self._calib = {
                    int(key): int(value)
                    for key, value in self.conf['rtapp-calib'].items()
                }
        else:
            self._log.info('Calibrating RTApp...')
            self._calib = RTA.calibrate(self.target)

        self._log.info('Using RT-App calibration values:')
        self._log.info('   %s',
                       "{" + ", ".join('"%r": %r' % (key, self._calib[key])
                                       for key in sorted(self._calib)) + "}")
        return self._calib
示例#4
0
    def calibration(self, force=False):

        if not force and self._calib:
            return self._calib

        required = False
        if force:
            required = True
        if 'rt-app' in self.__tools:
            required = True
        elif 'wloads' in self.conf:
            wloads = self.conf['wloads']
            for wl_idx in wloads:
                if 'rt-app' in wloads[wl_idx]['type']:
                    required = True
                    break

        if not required:
            logging.debug('No RT-App workloads, skipping calibration')
            return

        if not force and 'rtapp-calib' in self.conf:
            logging.warning(
                r'%14s - Using configuration provided RTApp calibration',
                'Target')
            self._calib = {
                int(key): int(value)
                for key, value in self.conf['rtapp-calib'].items()
            }
        else:
            logging.info(r'%14s - Calibrating RTApp...', 'Target')
            self._calib = RTA.calibrate(self.target)

        logging.info(r'%14s - Using RT-App calibration values:', 'Target')
        logging.info(
            r'%14s -    %s', 'Target',
            "{" + ", ".join('"%r": %r' % (key, self._calib[key])
                            for key in sorted(self._calib)) + "}")
        return self._calib