1. 26 Jan, 2022 1 commit
  2. 11 Nov, 2021 1 commit
  3. 26 Oct, 2021 1 commit
  4. 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
  5. 13 Nov, 2020 1 commit
  6. 20 Jul, 2020 1 commit
  7. 25 Jun, 2020 1 commit
  8. 27 Apr, 2020 1 commit
  9. 17 Apr, 2020 1 commit
  10. 24 Jan, 2020 1 commit
  11. 08 Nov, 2019 1 commit
  12. 09 Oct, 2019 1 commit
    • Clemens Backes's avatar
      [api] Use C++14 [[deprecated]] attribute · 739bee71
      Clemens Backes authored
      Since C++14, there is a spec'ed attribute for deprecation of methods,
      functions, types, aliases or anything else.
      This CL switches from the GCC __attribute__ to this standard attribute.
      This allows to use the V8_DEPRECATED and V8_DEPRECATE_SOON macros on
      anything where the standard attribute can be used (including {using}
      statements that were not working before). It also avoids the need to
      nest the whole declaration in the macro, making the code more readable.
      
      R=adamk@chromium.org
      
      Bug: v8:9810
      Change-Id: I7adab7694af75423fb31ade2fc982dbf9c9bc699
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1847361Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64174}
      739bee71
  13. 13 Sep, 2019 1 commit
  14. 05 Aug, 2019 1 commit
    • Peter Marshall's avatar
      [tracing] Fix TracingCpuProfiler test for Perfetto · 5ab7510e
      Peter Marshall authored
      Update the TracingCpuProfiler test to work properly with perfetto.
      
      Roll perfetto to get fixes for bugs encountered with starting/stopping
      tracing rapidly, which happens in the test for the tracing profiler.
      
      Add a check that the DataSource::Register call was successful to flush
      out any errors there (although they are fixed by the perfetto roll).
      
      Emit a fake trace event when stopping tracing in order to avoid
      losing the final trace event that the user provided. Remove the ad-hoc
      fake final trace events that the cctests for perfetto added.
      
      Add a test StartAndStopRepeated which flushes out the issues fixed by
      the perfetto roll.
      
      TBR=yangguo@chromium.org
      
      Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng
      Bug: v8:8339
      Change-Id: I042d7385486bf42c86f1631406974693868a477f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1731006
      Commit-Queue: Peter Marshall <petermarshall@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#63083}
      5ab7510e
  15. 08 Jul, 2019 1 commit
    • Peter Marshall's avatar
      [tracing] Use the new perfetto client API · edd383fb
      Peter Marshall authored
      The client API provides a much simpler interface so that we don't have
      to deal with producers, consumers etc. directly. This CL removes all the
      code that dealt with the more complex API used previously.
      
      The architecture used here requires that the embedder call into
      Tracing::Initialize() to set up the tracing backend. The tracing
      controller then connects to this backend when calling
      DataSource::Register() and Tracing::NewTrace(). This will ultimately
      avoid the need for a virtual call (or two) for every trace event that
      need to be dispatched over the API - chrome can provide a backend
      and V8 will connect to it opaquely with the same code when tracing is
      enabled.
      
      Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng
      Bug: v8:8339
      Change-Id: I6b74fbb49ffcc89638caeb59ed3d5cc81238f3e8
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1634916Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Commit-Queue: Peter Marshall <petermarshall@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#62568}
      edd383fb
  16. 27 May, 2019 1 commit
    • Peter Marshall's avatar
      [tracing] Add a way to test perfetto traces. · d365f62e
      Peter Marshall authored
      Add a new abstract class TraceEventListener which is just an interface
      for consuming trace events. This separates the V8-specific stuff that
      an actual perfetto consumer needs to do e.g. handling the has_more flag
      and signalling back to the controller with a semaphore.
      
      This is a change from the previous plan of making the PerfettoConsumer
      class sub-classable to implement custom consumption of trace events.
      This will be difficult when the consumer is created outside of the
      PerfettoTracingController as we can't hook up the
      consumer_finished_semaphore_ that belongs to the controller.
      
      Now the PerfettoTracingController is responsible for the Consumer life-
      cycle and hides it entirely from callers. We add the
      AddTraceEventListener() method to allow callers to register a listener
      either for testing or a JSON listener for real tracing.
      
      This lets us write tests that can store all the trace events in memory
      without first converting them to JSON, letting us write test more
      easily. There's an example test add to test-tracing - more tests using
      this style will follow.
      
      Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng
      Bug: v8:8339
      Change-Id: I2d2b0f408b1c7bed954144163e1968f40d772c1b
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1628789
      Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
      Auto-Submit: Peter Marshall <petermarshall@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61854}
      d365f62e
  17. 23 May, 2019 1 commit
    • Peter Marshall's avatar
      Reland "[tracing] Add a configurable output stream for perfetto tracing" · d5688b1f
      Peter Marshall authored
      This is a reland of a03ed626
      
      Removed the added test which was failing on win32. The test was unrelated
      to the CL; we can add it later.
      
      Original change's description:
      > [tracing] Add a configurable output stream for perfetto tracing
      >
      > Add the ability to provide perfetto with an output stream for the JSON
      > consumer rather than hardcode it. D8 will use this interface exclusively
      > once the old trace controller is removed.
      >
      > Also add a test for scope-managed trace events and their duration - this
      > was leftover from a previous CL.
      >
      > Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng
      > Bug: v8:8339
      > Change-Id: I1c45e17e528b549a4cfdaecabd33c7ac4ab4af77
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1611801
      > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
      > Reviewed-by: Jakob Gruber <jgruber@chromium.org>
      > Commit-Queue: Peter Marshall <petermarshall@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#61753}
      
      TBR=jgruber@chromium.org, ulan@chromium.org
      
      Bug: v8:8339
      Change-Id: I3442a4d111e12947c107e7d0c226ae934acd06e4
      Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1627334Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Commit-Queue: Peter Marshall <petermarshall@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61780}
      d5688b1f
  18. 22 May, 2019 2 commits
  19. 03 May, 2019 1 commit
  20. 21 Feb, 2019 1 commit
    • Peter Marshall's avatar
      [tracing] Fix races in TracingController implementation · 51e80efd
      Peter Marshall authored
      The default TracingController (used by d8 and Node) has some concurrency
      issues. The new test flushes these out, when a second thread logs trace
      events while the main thread calls StopTracing().
      
      - Use an acquire load in UpdateCategoryGroupEnabledFlags() because this
        was racing with GetCategoryGroupEnabled() where a new category is
        added in the slow path. g_category_groups is append-only, but
        reads/writes to g_category_index need to be correctly ordered so that
        new categories are added and only then is the change to the index
        visible. The relaxed load ignored this and caused unsynchronized
        read/write.
      - Use a relaxed load in ~ScopedTracer() to access category_group_enabled
        as this previously used a non-atomic operation which caused a race
        with UpdateCategoryGroupEnabledFlag() which does a relaxed store.
      - Replace TracingController::mode_ with an atomic bool as read/writes to
        mode_ were not synchronized and caused TSAN errors. It only has two
        states and it doesn't seem like we will extend this so just convert it
        to bool.
      - Take the lock around calling trace_object->Initialize in
        AddTraceEvent(), and around trace_buffer_->Flush() in StopTracing().
        These two raced previously as the underlying TraceBufferRingBuffer
        passes out pointers to TraceObjects in a synchronized way, but the
        caller (AddTraceEvent) then writes into the object without
        synchronization. This leads to races when Flush() is called, at which
        time TraceBufferRingBuffer assumes that all the pointers it handed out
        are to valid, initialized TraceObjects - which is not true because
        AddTraceEvent may still be calling Initialize on them. This could be
        the cause of issues in Node.js where the last line of tracing/logging
        sometimes gets cut off. This is kind of a band-aid solution - access
        to the TraceObjects handed out by the ring buffer really needs proper
        synchronization which at this point would require redesign. It's quite
        likely we will replace this with Perfetto in the near future so not
        much point investing in this code right now.
      - Enable TracingCpuProfiler test which was flaky due to these bugs.
      
      Bug: v8:8821
      Change-Id: I141296800c6906ac0e7f3f21dd16d861b07dae62
      Reviewed-on: https://chromium-review.googlesource.com/c/1477283
      Commit-Queue: Peter Marshall <petermarshall@chromium.org>
      Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
      Reviewed-by: 's avatarAli Ijaz Sheikh <ofrobots@google.com>
      Cr-Commit-Position: refs/heads/master@{#59752}
      51e80efd
  21. 19 Feb, 2019 1 commit
  22. 11 Feb, 2019 1 commit
  23. 15 Jan, 2019 1 commit
  24. 20 Sep, 2018 1 commit
  25. 20 Jul, 2018 1 commit
  26. 09 May, 2018 1 commit
  27. 07 May, 2018 1 commit
  28. 23 Mar, 2018 1 commit
  29. 28 Feb, 2018 1 commit
    • Andreas Haas's avatar
      [cleanup] Deprecate EnsureEventLoopInitialized · 9bacf523
      Andreas Haas authored
      Due to a recent refactoring the function EnsureEventLoopInitialized on
      the default platform became obsolete. It does not contain a single line
      of code. With this CL we prepare the removal of this function from the
      V8 platform API.
      
      R=rmcilroy@chromium.org
      
      Bug: v8:7310
      Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;master.tryserver.chromium.linux:linux_chromium_rel_ng
      Change-Id: If4d54cd989f8df2f40b322be3b67bb8a482398d0
      Reviewed-on: https://chromium-review.googlesource.com/934221
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#51635}
      9bacf523
  30. 12 Jan, 2018 1 commit
  31. 10 Jan, 2018 1 commit
  32. 14 Nov, 2017 1 commit
  33. 03 Jul, 2017 1 commit
    • Jochen Eisinger's avatar
      Reland "Switch tracing to use v8::TracingController" · cc59f8b1
      Jochen Eisinger authored
      Original change's description:
      > Switch tracing to use v8::TracingController
      >
      > BUG=v8:6511
      > R=fmeawad@chromium.org
      >
      > Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
      > Change-Id: I4961e4b61a9ddc98385ed97c3ffcbcaef2d9cba7
      > Reviewed-on: https://chromium-review.googlesource.com/543144
      > Commit-Queue: Jochen Eisinger <jochen@chromium.org>
      > Reviewed-by: Fadi Meawad <fmeawad@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#46307}
      
      BUG=v8:6511
      TBR=fmeawad@chromium.org
      
      Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng;master.tryserver.v8:v8_linux64_tsan_rel
      Change-Id: Ide32b409248dfd466e7c0bae1d8ae61d6a955d98
      Reviewed-on: https://chromium-review.googlesource.com/558865
      Commit-Queue: Jochen Eisinger <jochen@chromium.org>
      Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#46381}
      cc59f8b1
  34. 29 Jun, 2017 2 commits
  35. 26 Jun, 2017 1 commit
  36. 22 Jun, 2017 1 commit
  37. 10 May, 2017 2 commits