[latency] directories passed by launch args
:Release Notes: - :Detailed Notes: - :Testing Performed: - :QA Notes: - :Issues Addressed: -
This commit is contained in:
parent
420e42daeb
commit
bc714398ad
@ -8,11 +8,21 @@ import logging
|
||||
# Configure logging to show informational messages
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
|
||||
prefixImage = 'histograms/'
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(prog=__file__)
|
||||
parser.add_argument('-c', '--compensate', action="store_true")
|
||||
parser.add_argument('--latency-csv',
|
||||
type=str,
|
||||
default='sample/latencyDataframenvh264enc.csv',
|
||||
help='Path to the latency results CSV file.')
|
||||
parser.add_argument('-pd','--plot-dir',
|
||||
type=str,
|
||||
default='plots/',
|
||||
help='Path to directory in which resulted plots should be saved')
|
||||
parser.add_argument('-csv', '--csv-dir',
|
||||
type=str,
|
||||
default='results/',
|
||||
help='Path to directory in which resulted csv data should be saved')
|
||||
return parser.parse_args()
|
||||
|
||||
cmd_args = None
|
||||
@ -56,7 +66,7 @@ def plot_latency_data(df):
|
||||
plt.grid(axis='y', linestyle='--', alpha=0.6)
|
||||
|
||||
plt.tight_layout()
|
||||
plt.savefig(prefixImage + f'combined_top_configurations_plot_{encoder_name}.png')
|
||||
plt.savefig(get_args().plot_dir + f'combined_top_configurations_plot_{encoder_name}.png')
|
||||
plt.close()
|
||||
|
||||
# Output Notes (for user interpretation)
|
||||
@ -64,6 +74,17 @@ def plot_latency_data(df):
|
||||
for index, note in max_notes.items():
|
||||
print(f"Index {index}: {note}")
|
||||
|
||||
def plot_start_latency(df):
|
||||
fig = plt.figure(figsize=(10, 6), dpi=300)
|
||||
r1 = np.arange(len(df))
|
||||
plt.plot(r1, df['max'])
|
||||
plt.xlabel('Индекс конфигурации', fontweight='bold')
|
||||
plt.ylabel('Общая задержка [мс]', fontweight='bold')
|
||||
encoder_name = df.index.get_level_values(0)[0]
|
||||
plt.title(f"Результаты стартовой задержки для {encoder_name}")
|
||||
plt.tight_layout()
|
||||
plt.savefig(get_args().plot_dir + f"start_latency_{encoder_name}.png")
|
||||
plt.close()
|
||||
|
||||
def analyze_latency_data(csv_path: str):
|
||||
"""
|
||||
@ -122,14 +143,21 @@ def analyze_latency_data(csv_path: str):
|
||||
|
||||
# 3. Filter the original summary DataFrame (df_summary) using the common indices
|
||||
df_common_top_performers = df_summary.loc[common_indices]
|
||||
encoder_name = df_common_top_performers.index.get_level_values(0)[0]
|
||||
|
||||
print(df_common_top_performers.head())
|
||||
|
||||
plot_latency_data(df_common_top_performers)
|
||||
|
||||
plot_start_latency(df_common_top_performers)
|
||||
|
||||
# 4. Save top performers to csv
|
||||
top_10_df = df_common_top_performers.head(10)
|
||||
top_10_df.to_csv(get_args().csv_dir + f"{encoder_name}.csv")
|
||||
return
|
||||
|
||||
if __name__ == '__main__':
|
||||
parse_args()
|
||||
# Set the path to your CSV file here.
|
||||
csv_filename = 'sample/latencyDataframenvh264enc.csv'
|
||||
analyze_latency_data(csv_filename)
|
||||
os.makedirs(get_args().csv_dir, exist_ok=True)
|
||||
os.makedirs(get_args().plot_dir, exist_ok=True)
|
||||
analyze_latency_data(get_args().latency_csv)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user