Skip to contentSkip to conversation

qemurunner: Add info log for qemu startup

PATCH New Saul Wold 1 participant 1 message Jun 24, 2021

lore
Share & tools
lore

Saul Wold

author
#0 lore raw

PATCH 1/1 qemurunner: Add info log for qemu startup

Add a couple of logging info to track time between activities, first is from after the Popen(launch_cmd) to after qmp.connect(), second is from qmp.connect() to the release of the qemu via the qmp("cont") command this includes the mmap() activity.

Example output:
QMP connected to QEMU at 06/24/21 11:11:56 and took 0.9556229114532471 seconds from launch QMP released QEMU at 06/24/21 11:11:56 and took 0.26789021492004395 seconds from connect

---
 meta/lib/oeqa/utils/qemurunner.py | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/lib/oeqa/utils/qemurunner.py +8 -0
index abbc7f7d1f6..c7f78603179 100644
@@ -236,6 +236,7 @@ class QemuRunner:
         # to be a proper fix but this will suffice for now.
         self.runqemu = subprocess.Popen(launch_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, preexec_fn=os.setpgrp, env=env, cwd=self.tmpdir)
         output = self.runqemu.stdout
+        launch_time = time.time()
 
         #
         # We need the preexec_fn above so that all runqemu processes can easily be killed
@@ -339,6 +340,10 @@ class QemuRunner:
 
             try:
                 self.qmp.connect()
+                connect_time = time.time()
+                self.logger.info("QMP connected to QEMU at %s and took %s seconds" %
+                                  (time.strftime("%D %H:%M:%S"),
+                                   time.time() - launch_time))
             except OSError as msg:
                 self.logger.warning("Failed to connect qemu monitor socket: %s File: %s" % (msg, msg.filename))
                 return False
@@ -367,6 +372,9 @@ class QemuRunner:
 
         # Release the qemu process to continue running
         self.run_monitor('cont')
+        self.logger.info("QMP released QEMU at %s and took %s seconds from connect" %
+                          (time.strftime("%D %H:%M:%S"),
+                           time.time() - connect_time))
 
         # We are alive: qemu is running
         out = self.getOutput(output)
Signature · 1 line
2.25.1