Skip to content

Commit

Permalink
centipede: fix average_exec_per_sec stat (#4603)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsemel authored Jan 15, 2025
1 parent 1b4efb5 commit 4cca6fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/clusterfuzz/_internal/bot/fuzzers/centipede/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ def fuzz(self, target_path, options, reproducers_dir, max_time): # pylint: disa
'actual_duration': actual_duration,
'fuzzing_time_percent': fuzzing_time_percent,
})
fuzz_time_secs_avg = stats.get('FuzzTimeSec_Avg', 1.0)
if fuzz_time_secs_avg == 0.0:
fuzz_time_secs_avg = 1.0
num_execs_avg = stats.get('NumExecs_Avg', 0.0)
stats['average_exec_per_sec'] = num_execs_avg / fuzz_time_secs_avg
stats.update(_parse_centipede_logs(log_lines))
return engine.FuzzResult(fuzz_result.output, fuzz_result.command, crashes,
stats, fuzz_result.time_executed)
Expand Down
4 changes: 4 additions & 0 deletions src/clusterfuzz/_internal/metrics/fuzzer_stats_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,10 @@
'mode': 'NULLABLE',
'name': 'fuzzing_time_percent',
'type': 'FLOAT'
}, {
'mode': 'NULLABLE',
'name': 'average_exec_per_sec',
'type': 'FLOAT'
}] + _COMMON_COLUMNS

_SCHEMA = {
Expand Down
4 changes: 2 additions & 2 deletions src/local/butler/scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ def __init__(self):
logs: "Link to fuzzing logs"
corpus_backup: "Backup copy of the minimized corpus generated based on code coverage"'''

self.stats_columns = """sum(t.number_of_executed_units) as tests_executed,
self.stats_columns = """sum(t.NumExecs_Max) as tests_executed,
custom(j.new_crashes) as new_crashes,
_EDGE_COV as edge_coverage,
_COV_REPORT as cov_report,
_CORPUS_SIZE as corpus_size,
avg(t.FuzzTimeSec_Avg / t.NumExecs_Avg) as avg_exec_per_sec,
avg(t.average_exec_per_sec) as avg_exec_per_sec,
avg(t.fuzzing_time_percent) as fuzzing_time_percent,
avg(t.crash_count*100) as regular_crash_percent,
avg(t.oom_count*100) as oom_percent,
Expand Down

0 comments on commit 4cca6fc

Please sign in to comment.