Skip to content

Commit a44e478

Browse files
committed
fix(trace): 修复analyzer遇到除0的情况
1 parent 3caf608 commit a44e478

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/trace/tools/analyzer/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,10 @@ int main(int argc, char **argv)
245245

246246
//! 处理统计数据
247247
for (auto &stat : stat_vec) {
248-
stat.dur_avg_us = stat.dur_acc_us / stat.times;
249-
stat.dur_warn_line_us = (stat.dur_avg_us + stat.dur_max_us) / 2;
248+
if (stat.times > 0) {
249+
stat.dur_avg_us = stat.dur_acc_us / stat.times;
250+
stat.dur_warn_line_us = (stat.dur_avg_us + stat.dur_max_us) / 2;
251+
}
250252
}
251253

252254
//! 第二次遍历记录文件,标出超出警告线的

0 commit comments

Comments
 (0)