From 2f9b5d615b8af284cb98a149fd2fb1e364fa690d Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Tue, 30 May 2023 20:37:02 +0000 Subject: [PATCH] feat: add qemu start up time before ssh and test duration logs --- pew.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pew.go b/pew.go index 7adc324..32c9d48 100644 --- a/pew.go +++ b/pew.go @@ -641,6 +641,12 @@ func (cmd PewCmd) testArtifact(swg *sizedwaitgroup.SizedWaitGroup, Logger() slog.Info().Msg("start") + testStart := time.Now() + defer func() { + slog.Debug().Str("test_duration", + time.Now().Sub(testStart).String()). + Msg("") + }() kernel := qemu.Kernel{KernelPath: ki.KernelPath, InitrdPath: ki.InitrdPath} if cmd.RootFS != "" { @@ -678,6 +684,7 @@ func (cmd PewCmd) testArtifact(swg *sizedwaitgroup.SizedWaitGroup, q.Timeout = 0 } + qemuStart := time.Now() err = q.Start() if err != nil { slog.Error().Err(err).Msg("qemu start") @@ -743,6 +750,9 @@ func (cmd PewCmd) testArtifact(swg *sizedwaitgroup.SizedWaitGroup, result.InternalError = err return } + slog.Debug().Str("qemu_startup_duration", + time.Now().Sub(qemuStart).String()). + Msg("ssh is available") remoteTest, err := copyTest(q, cmd.Test, ka) if err != nil {