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 seconts 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, shell=True)
def __init__(self, proc, ifname, res, ndlrunner_bin, cstats=None, ts_bin=None, 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. * ifname - the network interface name to use for measuring the latency. * res - the 'WORawResult' object to store the results at. * ndlrunner_bin - path to the 'ndlrunner' helper. * cstats - True: collect C-state statistics, fail if 'turbostat' not found. None: collect C-state statistics, only if 'turbostat' is found. False: do not collect C-state statistics. * ts_bin - path to the 'turbostat' tool, default is just "turbostat". * ldist - for how far in the future the delayed network packets should be scheduled in microseconds. Default is [5000, 10000] microseconds. """ self._proc = proc self._ifname = ifname self._res = res self._ndlrunner_bin = ndlrunner_bin self._run_ts = cstats self._ts_bin = ts_bin self._ldist = ldist self._ts_heading = "" self._ndl_lines = None self._drv = None self._rtd_path = None self._ndlrunner = None self._colmap = None self._progress = None self._max_rtd = 0 self._post_trigger = None self._post_trigger_thresh = None self._etfqdisc = None self._nmcli = None self._netif = None self._verify_input_args() self._cstate_stats_init() self._progress = _ProgressLine.ProgressLine(period=1) self._drv = KernelModule.KernelModule(proc, "ndl") mntpath = FSHelpers.mount_debugfs(proc=proc) self._rtd_path = mntpath.joinpath(f"{self._drv.name}/rtd") self._etfqdisc = _ETFQdisc.ETFQdisc(ifname, proc=proc)
def __init__(self, devid, cpunum, proc, ldist=None, force=False): """ Initialize a class instance for a PCI device 'devid'. The arguments are as follows. * devid - the device "ID", which can be a PCI address or a network interface name. * 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 - how far in future should the delayed event be scheduled. * force - initialize measurement device, even if it is already in use. """ self._cpunum = cpunum self._proc = proc self._ldist = ldist self._drv = None self._saved_drvname = None self.dev = None self._basedir = None self._enable_path = None self._main_drv = None # This is a debugging option that allows to disable automatic wult modules unloading on # 'close()'. self.unload = True # Whether kernel messages should be monitored. They are very useful if something goes wrong. self.dmesg = True self.dev = Devices.WultDevice(devid, cpunum, proc, force=force) self._main_drv = KernelModule.KernelModule(proc, "wult") self._drv = KernelModule.KernelModule(proc, self.dev.drvname) mntpoint = FSHelpers.mount_debugfs(proc=proc) self._basedir = mntpoint / "wult" self._enable_path = self._basedir / "enabled" 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)