diff options
author | David Sommerseth <davids@redhat.com> | 2013-01-17 22:53:30 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2013-01-17 22:53:30 +0100 |
commit | cfdd00e4079a6161f9c7c82a92c33622e4fa6637 (patch) | |
tree | c331a5c7673e6900540b6bfe5fca687c0e581900 /rteval/modules | |
parent | eefec3600c20c50bc54ad28160c81cbded01b870 (diff) | |
download | rteval-cfdd00e4079a6161f9c7c82a92c33622e4fa6637.tar.gz rteval-cfdd00e4079a6161f9c7c82a92c33622e4fa6637.tar.xz rteval-cfdd00e4079a6161f9c7c82a92c33622e4fa6637.zip |
cyclictest: Added --cyclictest-breaktrace feature
This enables the --breaktrace feature in the cyclictest tool, but
rteval will also collect the trace data and put it in the resulting
tarball.
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'rteval/modules')
-rw-r--r-- | rteval/modules/measurement/cyclictest.py | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py index f8ac29d..f116ab0 100644 --- a/rteval/modules/measurement/cyclictest.py +++ b/rteval/modules/measurement/cyclictest.py @@ -25,7 +25,7 @@ # are deemed to be part of the source code. # -import os, sys, subprocess, signal, libxml2 +import os, sys, subprocess, signal, libxml2, shutil from rteval.Log import Log from rteval.modules import rtevalModulePrototype @@ -213,6 +213,18 @@ class Cyclictest(rtevalModulePrototype): return '--smp' + def __get_debugfs_mount(self): + ret = None + mounts = open('/proc/mounts') + for l in mounts: + field = l.split() + if field[2] == "debugfs": + ret = field[1] + break + mounts.close() + return ret + + def _WorkloadSetup(self): self.__cyclicprocess = None pass @@ -234,9 +246,12 @@ class Cyclictest(rtevalModulePrototype): self.__getmode(), ] - if self.__cfg.has_key('threads') and __cfg.threads: + if self.__cfg.has_key('threads') and self.__cfg.threads: self.__cmd.append("-t%d" % int(self.__cfg.threads)) + if self.__cfg.has_key('breaktrace') and self.__cfg.breaktrace: + self.__cmd.append("-b%d" % int(self.__cfg.breaktrace)) + def _WorkloadTask(self): if self.__started: @@ -245,6 +260,16 @@ class Cyclictest(rtevalModulePrototype): self._log(Log.DEBUG, "starting with cmd: %s" % " ".join(self.__cmd)) self.__nullfp = os.open('/dev/null', os.O_RDWR) + + debugdir = self.__get_debugfs_mount() + if self.__cfg.has_key('breaktrace') and self.__cfg.breaktrace and debugdir: + # Ensure that the trace log is clean + trace = os.path.join(debugdir, 'tracing', 'trace') + fp = open(os.path.join(trace), "w") + fp.write("0") + fp.flush() + fp.close() + self.__cyclicprocess = subprocess.Popen(self.__cmd, stdout=subprocess.PIPE, stderr=self.__nullfp, @@ -275,6 +300,15 @@ class Cyclictest(rtevalModulePrototype): for n in self.__cyclicdata.keys(): self.__cyclicdata[n].reduce() + # If the breaktrace feature of cyclictest was enabled, put the trace + # into the log directory + debugdir = self.__get_debugfs_mount() + if self.__cfg.has_key('breaktrace') and self.__cfg.breaktrace and debugdir: + trace = os.path.join(debugdir, 'tracing', 'trace') + cyclicdir = os.path.join(self.__cfg.reportdir, 'cyclictest') + os.mkdir(cyclicdir) + shutil.copyfile(trace, os.path.join(cyclicdir, 'breaktrace.log')) + self._setFinished() self.__started = False os.close(self.__nullfp) @@ -314,7 +348,10 @@ def ModuleParameters(): "metavar": "DIST_US"}, "priority": {"descr": "Run cyclictest with the given priority", "default": 95, - "metavar": "PRIO"} + "metavar": "PRIO"}, + "breaktrace": {"descr": "Send a break trace command when latency > USEC", + "default": None, + "metavar": "USEC"} } |