コード例 #1
0
ファイル: _FTrace.py プロジェクト: intel/wult
    def __init__(self, proc, timeout=30):
        """
        Class constructor. The arguments are as follows.
          * proc - the 'Proc' or 'SSH' object that defines the host to operate on. This object will
                   keep a 'proc' reference and use it in various methods.
          * timeout - longest time in seconds to wait for data in the trace buffer.
        """

        self._reader = None
        self._proc = proc
        self.timeout = timeout
        self.raw_line = None

        mntpoint = FSHelpers.mount_debugfs(proc=proc)
        self.ftpath = mntpoint.joinpath("tracing/trace")
        self.ftpipe_path = mntpoint.joinpath("tracing/trace_pipe")

        for path in (self.ftpath, self.ftpipe_path):
            if not FSHelpers.isfile(path, proc=proc):
                raise ErrorNotSupported(
                    f"linux kernel function trace file was not found at "
                    f"'{path}'{proc.hostmsg}")

        cmd = f"cat {self.ftpipe_path}"
        name = "stale wult function trace reader process"
        ProcHelpers.kill_processes(cmd, log=True, name=name, proc=self._proc)
        self._clear()
        self._reader = self._proc.run_async(cmd)
コード例 #2
0
    def __init__(self,
                 dev,
                 cpunum,
                 proc,
                 ldist=None,
                 intr_focus=None,
                 early_intr=None,
                 dcbuf_size=None):
        """
        Initialize a class instance for a PCI device 'devid'. The arguments are as follows.
          * dev - the delayed event device object created by 'Devices.WultDevice()'.
          * cpunum - the measured CPU number.
          * proc - the host to operate on. This object will keep a 'proc' reference and use it in
                   various methods
          * ldist - a pair of numbers specifying the launch distance range. The default value is
                    specific to the delayed event driver.
          * intr_focus - enable inerrupt latency focused measurements ('WakeLatency' is not measured
                         in this case, only 'IntrLatency').
          * early_intr - enable intrrupts before entering the C-state.
          * dcbuf_size - size of a memory buffer to write to before requesting C-states in order to
                         "dirty" the CPU cache. By default the CPU cache dirtying fetature is
                         disabled. The size has to be an integer amount of bytes.
        """

        self.dev = dev
        self._cpunum = cpunum
        self._proc = proc
        self._ldist = ldist
        self._intr_focus = intr_focus
        self._early_intr = early_intr
        self._dcbuf_size = dcbuf_size
        self._drv = None
        self._saved_drvname = None
        self._basedir = None
        self._enabled_path = None
        self._main_drv = None

        # This is a debugging option that allows to disable automatic wult modules unloading on
        # 'close()'.
        self.unload = True

        self._main_drv = KernelModule.KernelModule("wult",
                                                   proc=proc,
                                                   dmesg=dev.dmesg_obj)
        self._drv = KernelModule.KernelModule(self.dev.drvname,
                                              proc=proc,
                                              dmesg=dev.dmesg_obj)

        mntpoint = FSHelpers.mount_debugfs(proc=proc)
        self._basedir = mntpoint / "wult"
        self._enabled_path = self._basedir / "enabled"
        self._intr_focus_path = self._basedir / "intr_focus"
        self._early_intr_path = self._basedir / "early_intr"
        self._dcbuf_size_path = self._basedir / "dcbuf_size"

        msg = f"Compatible device '{self.dev.info['name']}'{proc.hostmsg}:\n" \
              f" * Device ID: {self.dev.info['devid']}\n" \
              f"   - {self.dev.info['descr']}"
        _LOG.info(msg)
コード例 #3
0
ファイル: NdlRunner.py プロジェクト: intel/wult
    def __init__(self, proc, netif, res, ndlrunner_bin, ldist=None):
        """
        The class constructor. The arguments are as follows.
          * proc - the 'Proc' or 'SSH' object that defines the host to run the measurements on.
          * netif - the 'NetIface' object of network device used for measurements.
          * res - the 'WORawResult' object to store the results at.
          * ndlrunner_bin - path to the 'ndlrunner' helper.
          * ldist - a pair of numbers specifying the launch distance range in nanoseconds (how far
          *         in the future the delayed network packets should be scheduled). Default is
          *         [5000000, 50000000].
        """

        self._proc = proc
        self._netif = netif
        self._res = res
        self._ndlrunner_bin = ndlrunner_bin
        self._ldist = ldist
        self._ifname = netif.ifname

        self._ndl_lines = None
        self._drv = None
        self._rtd_path = None
        self._ndlrunner = None
        self._progress = None
        self._max_rtd = 0
        self._etfqdisc = None
        self._nmcli = None

        if not self._ldist:
            self._ldist = [5000000, 50000000]

        self._verify_input_args()

        self._progress = _ProgressLine.ProgressLine(period=1)
        self._drv = KernelModule.KernelModule("ndl", proc=proc)

        mntpath = FSHelpers.mount_debugfs(proc=proc)
        self._rtd_path = mntpath.joinpath(f"{self._drv.name}/rtd")
        self._etfqdisc = _ETFQdisc.ETFQdisc(netif, proc=proc)