tree: d6c2e1f9edbca36d54813a3dfb1030dc611b3ef4 [path history] [tgz]
  1. core/
  2. internal/
  3. ipc/
  4. service/
  5. test/
  6. api_benchmark.cc
  7. BUILD.gn
  8. console_interceptor.cc
  9. data_source.cc
  10. debug_annotation.cc
  11. event_context.cc
  12. interceptor.cc
  13. OWNERS
  14. platform.cc
  15. platform_fake.cc
  16. platform_posix.cc
  17. platform_windows.cc
  18. README.md
  19. trace_writer_base.cc
  20. traced_proto_unittest.cc
  21. traced_value.cc
  22. traced_value_unittest.cc
  23. tracing.cc
  24. tracing_policy.cc
  25. track.cc
  26. track_event_category_registry.cc
  27. track_event_legacy.cc
  28. track_event_state_tracker.cc
  29. virtual_destructors.cc
src/tracing/README.md

How to use this library

There are three options to use this library:

Option 1) Fully in-process

In this mode Producer, Consumers and the Service are hosted in the same process. This is not too interesting other than tests and particular cases of nesting tracing instances coming from different libraries within the same process (concrete example v8, skia and webrtc in Chrome). In this configuration, the client is expected to at least:

  • Create a TracingService instance via TracingService::CreateInstance (see core/tracing_service.h)
  • Subclass Producer (core/producer.h) and connect it to the service.
  • Provide a TaskRunner implementation (see test/test_task_runner.h)
  • Provide a trivial SharedMemory implementation (core/shared_memory.h) which is simply backed by a malloc() buffer.

Option 2) Using the provided UNIX RPC transport

The include/unix_rpc provides the building blocks necessary to implement a RPC mechanism that allows Producer(s), Consumer(s) and Service to be hosted on different processes on the same machine and talk over a UNIX domain socket.

  • Producer(s) are expected to get a service proxy via UnixServiceConnection::ConnectAsProducer().
  • The Service must be instantiated via UnixServiceHost::CreateInstance(). The returned instance encapsulates the Service and exposes two UNIX sockets (one for Producer(s), one for Consumer(s)) on the current process.

Option 3) Providing a custom RPC transport

Similar to Option 2, but the client creates its own transport mechanism, defining how methods are proxies between instances and providing a SharedMemory implementation that can be transferred through RPC. Concrete example of this is Chrome implementing this library over a Mojo transport.

Directory layout

include/ Is the public API that clients of this library are allowed to depend on. Headers inside include/ cannot depend on anything else.

src/ Is the actual implementation that clients can link but not expected to access at a source-code level.

Both have the following sub-structure:

{include,src}/core/ “Core” is the pure c++17 tracing machinery that deals with bookkeeping, ring-buffering, partitioning and multiplexing but knows nothing about platform-specific things like implementation of shared memory and RPC mechanism.

{include,src}/unix_rpc/ A concrete implementation of the transport layer based on UNIX domain sockets and posix shared memory.