Skip to content

Commit

Permalink
tools: sof_perf_analyzer: change module CPC calculation
Browse files Browse the repository at this point in the history
Previously, module CPC is calculated by multiplying the mean
value of cpu_peak with a margin scalar, however, abnormal peak
cycles are finally proved that it is caused by IRQ, with further
team discussion, an agreement was reached to use module average
multiplied with a margin as new way for CPC calculation.

Signed-off-by: Baofeng Tian <[email protected]>
  • Loading branch information
btian1 committed Dec 1, 2023
1 parent 2504bd6 commit 43bb8b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/sof_perf_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@

import pandas as pd

# currently, keep CPC = max(module peak) * CPC_MARGIN
CPC_MARGIN = 1.1
# CPC_MARGIN set to 1.5 because some modules have not running code, for example
# volume: volume have two kind of ramp type, linear and log, it only be runned when
# volume change happens.
# copier: there is attenuation inside, normally, it will not be runned.
# So we set a relative high margin for avg cycles.
# CPC = AVG(module) * CPC_MARGIN
CPC_MARGIN = 1.5

@dataclass()
class TraceItem:
Expand Down Expand Up @@ -243,7 +248,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)

Expand Down

0 comments on commit 43bb8b8

Please sign in to comment.