Skip to content
Snippets Groups Projects

Add a sprucing bandwidth test

Merged Shunan Zhang requested to merge add-new-bandwidth-tests into master
All threads resolved!
Files
9
###############################################################################
# (c) Copyright 2000-2022 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
'''
Each method works the same: reads in all relevant CSV files and combines into single dataframe
Writes out CSV and HTML for each df
'''
import pandas as pd
def rates_all_lines():
streams = [
'b_to_open_charm', 'rd', 'bandq', 'qee', 'charm', 'b_to_charmonia',
'slepton', 'c_to_dimuon', 'bnoc', 'dimuon'
]
frames = []
for stream in streams:
file = f'tmp/Output/Inter/rates-all-lines-wg-stream-{stream}.csv'
try:
df = pd.read_csv(file, header=None) # no lines, empty file
except:
continue
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')
html = df.to_html()
with open('tmp/Output/rates-for-all-lines.html', 'w') as f:
f.write(html)
return
def rates_wg_streams():
streams = [
'b_to_open_charm', 'rd', 'bandq', 'qee', 'charm', 'b_to_charmonia',
'slepton', 'c_to_dimuon', 'bnoc', 'dimuon'
]
frames = []
for stream in streams:
file = f'tmp/Output/Inter/rates-per-stream-wg-stream-{stream}.csv'
df = pd.read_csv(file, header=None)
frames.append(df)
df = pd.concat(frames)
df.columns = [
'Stream', 'Total Retention (%)', '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-wg-stream-configuration.csv')
html = df.to_html()
with open('tmp/Output/rates-wg-stream-configuration.html', 'w') as f:
f.write(html)
return
rates_all_lines()
rates_wg_streams()
Loading