• Camillo Bruni's avatar
    [counters] Fix reentrant timers for V8.Execute · fffcbaea
    Camillo Bruni authored
    This CL fixes a long standing issue where reentering TimedHistograms
    scopes would cause spurious measurements. Only the non-nested scopes
    yielded correct results.
    
    Due to the changed numbers, the V8.Execute histogram is renamed to
    V8.ExecuteMicroSeconds. Note that this histogram is also guarded
    behind the --slow-histograms flag due to the additional overhead.
    
    Unlike before, it does no longer include time for external callbacks
    and only measures self time. The following example illustrates the
    new behaviour:
    
    1. Enter V8:           |--+.......+--| self-time: 4 units (reported)
    2. Exit V8 (callback):    |-+...+-|    self-time: 2 units (ignored)
    3. Re-enter V8:             |---|      self-time: 3 units (reported)
    
    This would result in 2 histogram entries with 4 time units for the first
    V8 slice and 3 units for the nested part. Note that the callback time
    itself is ignored.
    
    This CL attempts to clean up how TimedHistograms work:
    - Histogram: the base class
    - TimedHistograms: used for time-related histograms that are not nested
    - NestedTimeHistograms: Extends TimedHistograms and is used for nested
      histograms
    
    This CL changes Histograms to not measure time themselves. Measurements
    happen in the *HistogramScopes:
    - BaseTimedHistogramScope: Base functionality
    - TimedHistogramScope: For non-nested measurements
    - NestedTimedHistogramScope: For nested measurements
    - PauseNestedTimedHistogramScope: Ignore time during a given scope.
      This is used to pause timers during callbacks.
    
    Additional changes:
    - ExternalCallbackScope now contains a PauseNestedTimedHistogramScope
      and always sets VMState<EXTERNAL>
    
    Bug: v8:11946
    Change-Id: I45e4b7ff77b5948b605dd50539044cb26222fa21
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3001345Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
    Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
    Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
    Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
    Commit-Queue: Camillo Bruni <cbruni@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#76111}
    fffcbaea
Name
Last commit
Last update
..
embedded Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
OWNERS Loading commit data...
code-serializer.cc Loading commit data...
code-serializer.h Loading commit data...
context-deserializer.cc Loading commit data...
context-deserializer.h Loading commit data...
context-serializer.cc Loading commit data...
context-serializer.h Loading commit data...
deserializer.cc Loading commit data...
deserializer.h Loading commit data...
mksnapshot.cc Loading commit data...
object-deserializer.cc Loading commit data...
object-deserializer.h Loading commit data...
read-only-deserializer.cc Loading commit data...
read-only-deserializer.h Loading commit data...
read-only-serializer.cc Loading commit data...
read-only-serializer.h Loading commit data...
references.h Loading commit data...
roots-serializer.cc Loading commit data...
roots-serializer.h Loading commit data...
serializer-deserializer.cc Loading commit data...
serializer-deserializer.h Loading commit data...
serializer.cc Loading commit data...
serializer.h Loading commit data...
snapshot-compression.cc Loading commit data...
snapshot-compression.h Loading commit data...
snapshot-data.cc Loading commit data...
snapshot-data.h Loading commit data...
snapshot-empty.cc Loading commit data...
snapshot-external.cc Loading commit data...
snapshot-source-sink.cc Loading commit data...
snapshot-source-sink.h Loading commit data...
snapshot-utils.cc Loading commit data...
snapshot-utils.h Loading commit data...
snapshot.cc Loading commit data...
snapshot.h Loading commit data...
startup-deserializer.cc Loading commit data...
startup-deserializer.h Loading commit data...
startup-serializer.cc Loading commit data...
startup-serializer.h Loading commit data...