sanitycheck: Record time used in BinaryHandler
So the time used to run boards which use the BinaryHandler can be
reported, record the time used from spawning the process until
it finnishes or is killed.
The BinaryHandler is used by the "native" boards, unit tests,
nsim and Renode.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
diff --git a/scripts/sanitycheck b/scripts/sanitycheck
index 4143d3e..b50d33b 100755
--- a/scripts/sanitycheck
+++ b/scripts/sanitycheck
@@ -581,6 +581,9 @@
verbose("Spawning process: " +
" ".join(shlex.quote(word) for word in command) + os.linesep +
"Spawning process in directory: " + self.outdir)
+
+ start_time = time.time();
+
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.outdir) as proc:
verbose("Spawning BinaryHandler Thread for %s" % self.name)
t = threading.Thread(target=self._output_reader, args=(proc, harness, ))
@@ -594,6 +597,8 @@
proc.wait()
self.returncode = proc.returncode
+ self.metrics["handler_time"] = time.time() - start_time;
+
if options.enable_coverage:
returncode = subprocess.call(["GCOV_PREFIX=" + self.outdir,
"gcov", self.sourcedir, "-b", "-s", self.outdir], shell=True)