From d6ae791a553e780effd6fc50c923812440b66ea2 Mon Sep 17 00:00:00 2001 From: Baofeng Tian Date: Fri, 1 Dec 2023 15:58:04 +0800 Subject: [PATCH] tools: sof_perf_analyzer: change module CPC calculation In daily performance test, we have a high and abnormal peak cycle for some module, recently, we find this abnormal peak cycle is caused by IRQ. Previously, module CPC is calculated by multiplying the mean value of cpu_peak with a margin scalar. With further team discussion based on the new finding, an agreement is reached to use the product of module average cycle and a margin as module CPC. Signed-off-by: Baofeng Tian --- tools/sof_perf_analyzer.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/sof_perf_analyzer.py b/tools/sof_perf_analyzer.py index 3d660e09..471ed773 100755 --- a/tools/sof_perf_analyzer.py +++ b/tools/sof_perf_analyzer.py @@ -27,8 +27,14 @@ import pandas as pd -# currently, keep CPC = max(module peak) * CPC_MARGIN -CPC_MARGIN = 1.1 +# CPC_MARGIN is set to 1.5, because there is some inactive code for some module +# due to unmet condition. For example: +# volume: ramp operation only run on volume change, but we don't do volume +# change in our test. + +# So, we set a relative high margin for avg cycles. +# CPC = AVG(module) * CPC_MARGIN +CPC_MARGIN = 1.5 @dataclass() class TraceItem: @@ -243,7 +249,7 @@ def analyze_perf_info(): perf_stats.columns = ['CPU_AVG(MIN)', 'CPU_AVG(AVG)', 'CPU_AVG(MAX)', 'CPU_PEAK(MIN)', 'CPU_PEAK(AVG)', 'CPU_PEAK(MAX)'] perf_stats['PEAK(MAX)/AVG(AVG)'] = perf_stats['CPU_PEAK(MAX)'] / perf_stats['CPU_AVG(AVG)'] - perf_stats['MODULE_CPC'] = perf_info.groupby('COMP_ID')['CPU_PEAK'].max() * CPC_MARGIN + perf_stats['MODULE_CPC'] = perf_info.groupby('COMP_ID')['CPU_AVG'].mean() * CPC_MARGIN # change data type from float to int perf_stats['MODULE_CPC'] = perf_stats['MODULE_CPC'].astype(int)