1. 01 Apr, 2021 1 commit
    • Sara Tang's avatar
      [diagnostics] Enable ETW stack-walking events build flag · f0061332
      Sara Tang authored
      Feedback from Microsoft partners indicates that it would be beneficial
      to enable ETW stack-walking events by default.
      
      This is difficult, because the --interpreted-frames-native-stack flag
      comes with a significant perf degradation. Ideally, we would turn
      this flag on dynamically, only when a ETW recorder is actively
      triggering the provider. Unfortunately, the flag in its current state
      cannot be enabled dynamically.
      
      In light of this, we have decided to only flip the build flag.
      
      Bug: v8:11043
      Change-Id: Id883b9bcd635b41139450ab2d5c92511422525a3
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2773792Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
      Commit-Queue: Sara Tang <sartang@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#73784}
      f0061332
  2. 02 Mar, 2021 1 commit
    • Sara Tang's avatar
      Step 2 (of 2) for ETW integration into V8 · 88926769
      Sara Tang authored
      Design doc:
      https://docs.google.com/document/d/1xkXj94iExFgLWc_OszTNyNGi523ARaKMWPZTeomhI4U
      
      This is the second (and hopefully final!) change list needed to
      integrate ETW into V8. In particular, we added stack-walking
      functionality for JIT-ted functions!
      
      Some notes on instrumentation:
        - The gist of getting stack-walking in ETW is we need to emit events
          with specific event IDs. These events get stitched into a pseudo-PDB
          that is recognizable by ETW.
        - Unfortunately, we cannot rely on the TraceLogging API from the first
          CL, as it does not support specifying event IDs. Instead, Bill
          Ticehurst wrote an API that peels back the TraceLogging API just
          enough so that we can specify event IDs. This API is the entirety of
          etw-metdata.h
        - We attach a CodeEventHandler that logs a stack-walking event whenever
          code movement is triggered.
      
      Bug: v8:11043
      Change-Id: I1bf57c985b7375f045089027855b1c03878abb78
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2616221Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Commit-Queue: Sara Tang <sartang@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#73145}
      88926769
  3. 05 Jan, 2021 1 commit
    • Sara Tang's avatar
      Step 1 (of 3-ish): Basic ETW Instrumentation in V8 · 8b33c872
      Sara Tang authored
      Design doc:
      https://docs.google.com/document/d/1xkXj94iExFgLWc_OszTNyNGi523ARaKMWPZTeomhI4U
      A lot has changed since the last patchset! I recommend revisiting this
      design doc and reading the parts in green. I explain the roadmap for
      what changes to expect from ETW instrumentation as well as the
      instrumentation of this particular CL.
      
      I'll do my best to answer any further questions anyone has about my
      particular instrumentation or ETW in general :)
      
      ---
      
      This is the first of a series of changelists to round out ETW
      instrumentation for V8.
      
      This changelist represents the most minimal change needed to instrument
      ETW in V8. In particular, it:
        - defines and registers the ETW provider,
        - interacts minimally with the rest of V8, by hooking into the
          existing TracingController::AddTraceEvent function,
        - is designed with a platform-agnostic layer, so that event tracers
          for other platforms can be instrumented in teh future.
      
      Some notes on instrumentation (aka I copied stuff from the design doc):
      
      We make heavy use of the TraceLogging API to log events. It differs from
      previous methods of emitting ETW events in that it doesn<E2><80><99>t
      require the overhead of a separate manifest file to keep track of
      metadata; rather, events using this API are self-descriptive.
      
      Here are the five major steps to instrument the TraceLogging API:
        - Forward declare the provider (from provider-win.h)
        - Define the provider in a .cc file (from provider-win.cc)
        - Register the provider (called from v8.cc).
        - Write events (called from libplatform/tracing-controller.cc)
        - Unregister the provider (called from v8.cc)
      
      At the base, we have an abstract provider class that encapsulates the
      functionality of an event provider. These are things like registering
      and unregistering the provider, and the actual event-logging.
      
      The provider class is split into provider-win and provider-mac
      (currently not instantiated) classes, with OS-dependent implementations
      of the above functions.
      
      In particular, the TraceLogging API is used only in provider-win. It is
      here that we forward declare and define the provider, as well as write
      ETW events.
      
      Finally, there is a v8-provider class that serves as a top-level API and
      is exposed to the rest of V8. It acts as a wrapper for the
      platform-specific providers.
      
      The .wprp file is needed so that Windows Performance Recorder knows how
      to capture our events.
      
      Some considerations:
        - Is TracingController::AddTraceEvent the best place from which to
          write my events?
        - Is src/libplatform/tracing the best place to put my instrumentation?
        - Right now, I fail the preupload because of this, which tells me my
          files are probably not in the best location:
      
      You added one or more #includes that violate checkdeps rules.
      src\init\v8.cc Illegal include: "src/libplatform/tracing/v8-provider.h"
      Because of "-src/libplatform" from src's include_rules.
      
      Change-Id: Id53e4a034c9e526524a17000da0a647a95d93edf
      Bug: v8:11043
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2233407Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
      Commit-Queue: Sara Tang <sartang@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#71918}
      8b33c872