Skip to content
Snippets Groups Projects

[RTADPA BW Tests] Introducing an Hlt1-bandwidth test via Moore_in_Allen

Merged Luke Grazette requested to merge lugrazet-BW-initialhlt1test into master
Compare and
4 files
+ 365
17
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 65
0
'''
Each method works the same: reads in all relevant CSV files
and combines into single dataframe.
It writes out CSV and HTML for each dataframe.
'''
import pandas as pd
import argparse
def highlight_vals(val, threshold, color='red'):
if val > threshold: return 'background-color: {}'.format(color)
else: return ''
def rates_all_lines(args):
frames = []
df = pd.read_csv(args.input_csv, header=None)
frames.append(df)
df = pd.concat(frames)
df.columns = [
'Line', 'Total Retention (%)', 'Rate (kHz)', 'Exclusive Retention(%)',
'Exclusive Rate (kHz)', 'Avg Total Event Size (kB)',
'Total Bandwidth (GB/s)', 'Avg DstData Size (kB)',
'DstData Bandwidth (GB/s)'
]
df = df.sort_values(
by=['Total Retention (%)'], ascending=False).reset_index(drop=True)
df.to_csv('tmp/Output/rates-for-all-lines.csv')
styler = df.style.applymap(
highlight_vals, subset=['Rate (kHz)'], threshold=1) # 1 kHz rate limit
styler = styler.applymap(
highlight_vals, subset=['Avg DstData Size (kB)'],
threshold=1e3) # 1 MB evt size limit
styler = styler.applymap(
highlight_vals, subset=['Avg Total Event Size (kB)'],
threshold=1e3) # 1 MB evt size limit
styler = styler.applymap(
highlight_vals, subset=['Total Bandwidth (GB/s)'],
threshold=0.2) # 200 MB/s bandwidth limit
styler = styler.applymap(
highlight_vals, subset=['DstData Bandwidth (GB/s)'],
threshold=0.2) # 200 MB/s bandwidth limit
html = styler.set_table_attributes("border=1").to_html()
with open('tmp/Output/rates-for-all-lines.html', 'w') as f:
f.write(html)
return
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument(
'-i',
'--input_csv',
type=str,
required=True,
help='Input MDF file to process')
args = parser.parse_args()
rates_all_lines(args)
Loading