mirror of
https://github.com/LTTLabsOSS/markbench-tests.git
synced 2026-01-10 06:28:05 -05:00
Updating recording harness to have a report.json (#42)
This commit is contained in:
@@ -6,24 +6,32 @@ import sys
|
||||
import time
|
||||
|
||||
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
log_dir = os.path.join(script_dir, "run")
|
||||
if not os.path.isdir(log_dir):
|
||||
os.mkdir(log_dir)
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
|
||||
LOGGING_FORMAT = '%(asctime)s %(levelname)-s %(message)s'
|
||||
logging.basicConfig(filename=f'{log_dir}/harness.log',
|
||||
format=LOGGING_FORMAT,
|
||||
datefmt='%m-%d %H:%M',
|
||||
from harness_utils.output import (
|
||||
write_report_json,
|
||||
setup_log_directory,
|
||||
seconds_to_milliseconds,
|
||||
DEFAULT_LOGGING_FORMAT,
|
||||
DEFAULT_DATE_FORMAT)
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG_DIRECTORY = os.path.join(SCRIPT_DIR, "run")
|
||||
setup_log_directory(LOG_DIRECTORY)
|
||||
|
||||
logging.basicConfig(filename=f'{LOG_DIRECTORY}/harness.log',
|
||||
format=DEFAULT_LOGGING_FORMAT,
|
||||
datefmt=DEFAULT_DATE_FORMAT,
|
||||
level=logging.DEBUG)
|
||||
console = logging.StreamHandler()
|
||||
formatter = logging.Formatter(LOGGING_FORMAT)
|
||||
formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT)
|
||||
console.setFormatter(formatter)
|
||||
logging.getLogger('').addHandler(console)
|
||||
|
||||
HOST = ''
|
||||
PORT = 30000
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
start_time = time.time()
|
||||
try:
|
||||
s.bind((HOST, PORT))
|
||||
except socket.error as msg:
|
||||
@@ -35,4 +43,12 @@ while True:
|
||||
time.sleep(0.1)
|
||||
conn, addr = s.accept()
|
||||
if conn:
|
||||
sys.exit(0)
|
||||
stop_time = time.time()
|
||||
report = {
|
||||
"start_time": seconds_to_milliseconds(start_time),
|
||||
"end_time": seconds_to_milliseconds(stop_time)
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user