Skip to content

Commit

Permalink
Addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamachor committed Feb 21, 2024
1 parent 77dac20 commit 050739b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
18 changes: 10 additions & 8 deletions metrics/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ def get_experiments_data(experiments_df: pd.DataFrame, target_granularity: str)
st.stop()

# Create tabs for current selection
exec_time_tab = None
performance_degradation_tab = None
exec_time_tab = None # This tab shows execution time.
performance_degradation_tab = None # This tab shows degradation rate.
# TODO
io_tab = None
io_api_calls_tab = None
cpu_utilization_tab = None
io_tab = None # This tab will show I/O metrics, such as bytes read/written.
io_api_calls_tab = None # This tab will show I/O API call metrics.
cpu_utilization_tab = None # This tab will show CPU utilization metrics.

if workload_selected == 'wp1_longevity':
exec_time_tab, performance_degradation_tab = st.tabs(['Execution Time', 'Performance Degradation'])
Expand Down Expand Up @@ -304,7 +304,8 @@ def get_experiments_data(experiments_df: pd.DataFrame, target_granularity: str)
.encode(
alt.X("configuration:N", axis=None, title='Configuration', stack=None),
alt.Y("time_diff_in_mins:Q", title='Latency (mins)', axis=alt.Axis(titleFontWeight='bold')),
alt.Color("configuration:N", legend=alt.Legend(titleFontWeight='bold', labelLimit=400), title='Configuration'),
alt.Color("configuration:N", legend=alt.Legend(titleFontWeight='bold', labelLimit=400),
title='Configuration'),
alt.Column("event_id:N", title="",
header=alt.Header(orient='bottom', labelFontWeight='bold', labelAlign='right',
labelAngle=-45, labelPadding=20),
Expand Down Expand Up @@ -341,7 +342,8 @@ def get_experiments_data(experiments_df: pd.DataFrame, target_granularity: str)
alt.Chart(grouped_df)
.encode(
alt.X("phase_type:N", title='', axis=alt.Axis(labelFontWeight='bold', labelAngle=-45)),
alt.Y("configuration:N", title='Configuration', axis=alt.Axis(titleFontWeight='bold', maxExtent=430, labelLimit=400))
alt.Y("configuration:N", title='Configuration',
axis=alt.Axis(titleFontWeight='bold', maxExtent=430, labelLimit=400))
)
)
heatmap = (
Expand All @@ -365,4 +367,4 @@ def get_experiments_data(experiments_df: pd.DataFrame, target_granularity: str)
)
)
performance_degradation_tab.markdown('#')
performance_degradation_tab.altair_chart(heatmap+text, theme=None)
performance_degradation_tab.altair_chart(heatmap + text, theme=None)
22 changes: 22 additions & 0 deletions metrics/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ def time_diff_in_minutes(time_str1, time_str2):

# -------- PERFORMANCE DEGRADATION -------- #
def performance_degradation(values: pd.DataFrame) -> float:
"""
Performance degradation is measured as the average rate of change between consecutive values.
Formula:
degradation_rate = (Σ((M[i] - M[i-1]) / M[i-1])) / (n - 1)
Where:
- M[i] is the current value
- M[i-1] is the previous value
- n is the number of observations
Args:
- values (pd.DataFrame): A DataFrame containing the values for which performance degradation is measured.
Returns:
- float: The average rate of performance degradation.
"""

# Calculate the difference between each value and its previous value
diffs = values.diff()
# Remove the first row as it will be NaN
Expand All @@ -37,4 +55,8 @@ def performance_degradation(values: pd.DataFrame) -> float:
diffs = diffs.div(values.shift(1))
# Calculate the average rate of change
degradation_rate = diffs.mean()

# TODO: Consider incorporating variance to understand the variability in performance degradation.
# TODO: Handle multiple runs for more comprehensive analysis.

return degradation_rate

0 comments on commit 050739b

Please sign in to comment.