[logging] moved fully to logging in gstreamerAutotest.log
This commit is contained in:
parent
c10ee32918
commit
900aca9bd5
@ -1,20 +1,20 @@
|
|||||||
repeats: 3
|
repeats: 3
|
||||||
|
|
||||||
options:
|
options:
|
||||||
# x264enc:
|
x264enc:
|
||||||
# bitrate: [ "10000", "20000", "5000" ]
|
bitrate: [ "10000", "20000", "5000" ]
|
||||||
# speed-preset: [ "ultrafast", "fast", "medium" ]
|
speed-preset: [ "ultrafast", "fast", "medium" ]
|
||||||
# tune: [ "zerolatency" ]
|
tune: [ "zerolatency" ]
|
||||||
# sliced-threads: [ "true", "false" ]
|
sliced-threads: [ "true", "false" ]
|
||||||
# b-adapt: [ "true", "false" ]
|
b-adapt: [ "true", "false" ]
|
||||||
# rc-lookahead: [ "40", "0" ]
|
rc-lookahead: [ "40", "0" ]
|
||||||
# ref: [ "3", "0" ]
|
ref: [ "3", "0" ]
|
||||||
# nvh264enc:
|
nvh264enc:
|
||||||
# bitrate: [ "10000", "20000", "5000" ]
|
bitrate: [ "10000", "20000", "5000" ]
|
||||||
# preset: [ "4", "5", "1" ]
|
preset: [ "4", "5", "1" ]
|
||||||
# rc-lookahead: [ "0" ]
|
rc-lookahead: [ "0" ]
|
||||||
# rc-mode: [ "2", "0", "5" ]
|
rc-mode: [ "2", "0", "5" ]
|
||||||
# zerolatency: [ "true", "false" ]
|
zerolatency: [ "true", "false" ]
|
||||||
nvv4l2h264enc:
|
nvv4l2h264enc:
|
||||||
bitrate: [ "10000000", "20000000", "5000000" ]
|
bitrate: [ "10000000", "20000000", "5000000" ]
|
||||||
profile: [ "0", "1", "2" ]
|
profile: [ "0", "1", "2" ]
|
||||||
|
|||||||
6
extra.py
6
extra.py
@ -1,4 +1,5 @@
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
def log_args_decorator(func):
|
def log_args_decorator(func):
|
||||||
@ -11,9 +12,10 @@ def log_args_decorator(func):
|
|||||||
pos_args = dict(zip(arg_names, args))
|
pos_args = dict(zip(arg_names, args))
|
||||||
all_args = {**pos_args, **kwargs}
|
all_args = {**pos_args, **kwargs}
|
||||||
|
|
||||||
print(f"Calling function '{func.__name__}' with arguments: {all_args}")
|
logging.debug(
|
||||||
|
f"Calling function '{func.__name__}' with arguments: {all_args}")
|
||||||
result = func(*args, **kwargs)
|
result = func(*args, **kwargs)
|
||||||
print(f"Function '{func.__name__}' returned: {result}")
|
logging.info(f"Function '{func.__name__}' returned: {result}")
|
||||||
return result
|
return result
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
from itertools import product
|
from itertools import product
|
||||||
|
from tqdm import tqdm
|
||||||
import qa
|
import qa
|
||||||
from latencyParse import getLatencyTable
|
from latencyParse import getLatencyTable
|
||||||
import os
|
import os
|
||||||
@ -15,10 +16,12 @@ import logging
|
|||||||
|
|
||||||
# Configure logging to show informational messages
|
# Configure logging to show informational messages
|
||||||
logging.basicConfig(level=logging.DEBUG,
|
logging.basicConfig(level=logging.DEBUG,
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s')
|
format='%(asctime)s - %(levelname)s - %(message)s',
|
||||||
|
filename=f"{os.path.basename(__file__).split('.')[0]}.log")
|
||||||
|
|
||||||
config = None
|
config = None
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
parser = argparse.ArgumentParser(prog=__file__)
|
parser = argparse.ArgumentParser(prog=__file__)
|
||||||
parser.add_argument('-c', '--config',
|
parser.add_argument('-c', '--config',
|
||||||
@ -27,6 +30,7 @@ def parse_args():
|
|||||||
help="Path to autotest configuration yaml file")
|
help="Path to autotest configuration yaml file")
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def get_config():
|
def get_config():
|
||||||
global config
|
global config
|
||||||
if config is None:
|
if config is None:
|
||||||
@ -168,7 +172,7 @@ def passwordAuth(proc):
|
|||||||
def printLog(file):
|
def printLog(file):
|
||||||
with open(file, "r") as f:
|
with open(file, "r") as f:
|
||||||
out = f.read()
|
out = f.read()
|
||||||
print(out)
|
logging.debug(f"\n{out}")
|
||||||
|
|
||||||
|
|
||||||
@is_docker
|
@is_docker
|
||||||
@ -195,7 +199,7 @@ def time_trace(func):
|
|||||||
func()
|
func()
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
elapsed_time = end_time - start_time
|
elapsed_time = end_time - start_time
|
||||||
print(emoji.emojize(
|
logging.info(emoji.emojize(
|
||||||
f":alarm_clock: Total execution time: {elapsed_time} seconds"))
|
f":alarm_clock: Total execution time: {elapsed_time} seconds"))
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
@ -204,15 +208,14 @@ def time_trace(func):
|
|||||||
def run_autotest():
|
def run_autotest():
|
||||||
qualityDataframe = pd.DataFrame()
|
qualityDataframe = pd.DataFrame()
|
||||||
latencyDataframe = pd.DataFrame()
|
latencyDataframe = pd.DataFrame()
|
||||||
|
|
||||||
encoders = generateEncoderStrings()
|
encoders = generateEncoderStrings()
|
||||||
for encoder, combinations in encoders.items():
|
for encoder, combinations in tqdm(encoders.items(), desc="Encoder loop"):
|
||||||
qualityDataframe = pd.DataFrame()
|
qualityDataframe = pd.DataFrame()
|
||||||
latencyDataframe = pd.DataFrame()
|
latencyDataframe = pd.DataFrame()
|
||||||
for params in combinations:
|
for params in tqdm(combinations, desc="params combination loop", leave=False):
|
||||||
for profile in get_config().profiles:
|
for profile in get_config().profiles:
|
||||||
for videoName, videoPath in get_config().videos.items():
|
for videoName, videoPath in tqdm(get_config().videos.items(), desc="videos loop", leave=False):
|
||||||
for _ in range(get_config().repeats):
|
for _ in tqdm(range(get_config().repeats), desc="repeat loop", leave=False):
|
||||||
filename = "autotest-" + encoder + "-" + \
|
filename = "autotest-" + encoder + "-" + \
|
||||||
profile + "-test-" + videoName + ".mp4"
|
profile + "-test-" + videoName + ".mp4"
|
||||||
pipeline = Pipeline()
|
pipeline = Pipeline()
|
||||||
@ -238,7 +241,7 @@ def run_autotest():
|
|||||||
)
|
)
|
||||||
dfPsnr = qa.parse_quality_report(
|
dfPsnr = qa.parse_quality_report(
|
||||||
psnr_metrics, ssim_metrics)
|
psnr_metrics, ssim_metrics)
|
||||||
print("-----")
|
logging.info("-----")
|
||||||
dfLatency = getLatencyTable(
|
dfLatency = getLatencyTable(
|
||||||
get_config().latency_filename)
|
get_config().latency_filename)
|
||||||
columnsQ = pd.MultiIndex.from_tuples(
|
columnsQ = pd.MultiIndex.from_tuples(
|
||||||
@ -255,10 +258,10 @@ def run_autotest():
|
|||||||
[qualityDataframe, dfPsnr], axis=1)
|
[qualityDataframe, dfPsnr], axis=1)
|
||||||
latencyDataframe = pd.concat(
|
latencyDataframe = pd.concat(
|
||||||
[latencyDataframe, dfLatency], axis=1)
|
[latencyDataframe, dfLatency], axis=1)
|
||||||
print("="*50)
|
logging.info("="*50)
|
||||||
print("Current results:")
|
logging.info("Current results:")
|
||||||
print(dfPsnr)
|
logging.info(f"\n{dfPsnr}")
|
||||||
print(dfLatency)
|
logging.info(f"\n{dfLatency}")
|
||||||
qualityDataframe.to_csv(
|
qualityDataframe.to_csv(
|
||||||
get_config().results_dir + f"qualityResults{encoder}.csv")
|
get_config().results_dir + f"qualityResults{encoder}.csv")
|
||||||
latencyDataframe.to_csv(
|
latencyDataframe.to_csv(
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import logging
|
||||||
# Idea is next:
|
# Idea is next:
|
||||||
# on set of experiments we are calculating all latency information -> each element avg, std, max numbers, total is not calculated, because it requires
|
# on set of experiments we are calculating all latency information -> each element avg, std, max numbers, total is not calculated, because it requires
|
||||||
# additional parsing for parallel branches (from tee)
|
# additional parsing for parallel branches (from tee)
|
||||||
@ -17,7 +18,8 @@ def findWord(words, wordToSearch):
|
|||||||
return words[idx]
|
return words[idx]
|
||||||
else:
|
else:
|
||||||
if idx >= len(words):
|
if idx >= len(words):
|
||||||
print(f"ERROR: trying to access index={idx} while: {words}")
|
logging.error(
|
||||||
|
f"ERROR: trying to access index={idx} while: {words}")
|
||||||
for word in words:
|
for word in words:
|
||||||
if word.startswith(wordToSearch):
|
if word.startswith(wordToSearch):
|
||||||
idx = words.index(word)
|
idx = words.index(word)
|
||||||
@ -70,7 +72,7 @@ def readAndParse(filename):
|
|||||||
def getLatencyTable(filename):
|
def getLatencyTable(filename):
|
||||||
parsed = readAndParse(filename)
|
parsed = readAndParse(filename)
|
||||||
df = pd.DataFrame(parsed)
|
df = pd.DataFrame(parsed)
|
||||||
print(df)
|
logging.debug(f"\n{df}")
|
||||||
latency_row = df.loc['latency']
|
latency_row = df.loc['latency']
|
||||||
ts_list = df.loc['ts']
|
ts_list = df.loc['ts']
|
||||||
|
|
||||||
@ -90,8 +92,9 @@ def getLatencyTable(filename):
|
|||||||
resultDf = pd.concat(
|
resultDf = pd.concat(
|
||||||
[df_dt_max, max_latency, avg_latency, median_latency, std_latency], axis=1)
|
[df_dt_max, max_latency, avg_latency, median_latency, std_latency], axis=1)
|
||||||
resultDf.columns = ['dTmax', 'max', 'avg', 'median', 'std']
|
resultDf.columns = ['dTmax', 'max', 'avg', 'median', 'std']
|
||||||
print(resultDf)
|
logging.debug(f"\n{resultDf}")
|
||||||
return resultDf
|
return resultDf
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
getLatencyTable("latency_traces-x264enc-kpop-test-10.log")
|
getLatencyTable("latency_traces-x264enc-kpop-test-10.log")
|
||||||
|
|||||||
@ -14,4 +14,5 @@ python-dotenv==1.1.1
|
|||||||
pytz==2025.2
|
pytz==2025.2
|
||||||
PyYAML==6.0.3
|
PyYAML==6.0.3
|
||||||
six==1.17.0
|
six==1.17.0
|
||||||
|
tqdm==4.67.1
|
||||||
tzdata==2025.2
|
tzdata==2025.2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user