Description
As mentioned in the description of #2969 , to make monitors work better, one of the following works is to add more necessary statistics. After reading the source code, I realized that statistics are related to three core structures: StdState
, AflStatsStage
, and ClientStats
.
I'm totally aware of what these structures are designed to do and why they are designed to be split into three structures:
StdState
is used to maintain fuzzing states, and provide those statistics to others who need it.AflStatsStage
is used to emitfuzzer_stats
abdplot_data
file after each cycle.ClientStats
is used to maintain statistics for monitors to display.
However, I find there are some inconsistencies among these structures, and I don't know the reason, which prevents me from refactoring these codes.
For example, there is a last_found_time
in StdState
which is used to report the last time something was added to the corpus, and is designed to be accessed by HasLastReportTime
trait (although nobody uses this). However, instead of taking this data from the state, the AflStatsStage
individually maintains a last_find
field by probing the scheduled count. Moreover, it also maintains a last_crash
and a last_hang
, which the StdState
lacks.
So my question is: should I refactor those codes to keep every useful data in StdState
, and retrieve those data in AflStatsStage
and ClientStats
by related traits (such as HasLastReportTime
)? If not, by what rule should I decide to maintain certain statistics in one of these three structures?