• François Degros's avatar
    Simplified and optimized StatisticsRecorder. · b86ebc88
    François Degros authored
    StatisticsRecorder is now an actual container of collections.
    
    There is only one global recorder at any time, referenced by
    StatisticsRecorder::top_.
    
    Each StatisticsRecorder also has a pointer to the previous global recorder.
    
    We now have a stack (singly linked list) of StatisticsRecorder objects, where
    the top of the stack (StatisticsRecorder::top_) is the current global recorder.
    
    This pattern is clearer and cleaner. It avoids a bunch of static variables,
    indirections, unique_ptrs and calls to operator new. It gets rid of the ugly
    hacks of UninitializeForTesting. It reduces memory fragmentation by having fewer
    dynamically allocated objects.
    
    Removed methods Reset, UninitializeForTesting and DumpHistogramsToVlog. They are
    now unnecessary.
    
    Reviewed, clarified and documented the thread safety status of each method.
    
    Added comments.
    
    
    Change-Id: Ia1a7611905009d0449068c801464ad0df7813c0d
    Bug: 
    Reviewed-on: https://chromium-review.googlesource.com/830997
    Commit-Queue: François Degros <fdegros@chromium.org>
    Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#526570}
    b86ebc88
statistics_recorder.cc 12.9 KB