monitor: add assembler/stage duration
Allow a user to see the duration for each step in the osbuild pipeline. This allows a user to optimize the build system for the best performance and identify performance bottlenecks. Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
parent
0ee38b00d1
commit
c0d71c3fa1
1 changed files with 7 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ import abc
|
|||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from typing import Dict
|
||||
|
||||
|
|
@ -90,6 +91,10 @@ class LogMonitor(BaseMonitor):
|
|||
the log will get written to. If `fd` is a `TTY`, escape
|
||||
sequences will be used to highlight sections of the log.
|
||||
"""
|
||||
def result(self, result):
|
||||
duration = int(time.time() - self.timer_start)
|
||||
self.out.write(f"\n⏱ Duration: {duration}s\n")
|
||||
|
||||
def stage(self, stage):
|
||||
self.module(stage)
|
||||
|
||||
|
|
@ -112,6 +117,8 @@ class LogMonitor(BaseMonitor):
|
|||
json.dump(options, self.out, indent=2)
|
||||
self.out.write("\n")
|
||||
|
||||
self.timer_start = time.time()
|
||||
|
||||
def log(self, message):
|
||||
self.out.write(message)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue