tree: ec4c84268ca27f05071fa5944177cee5a8d11000 [path history] [tgz]
  1. consumer_api_deprecated/
  2. core/
  3. internal/
  4. ipc/
  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. platform.cc
  14. platform_fake.cc
  15. platform_posix.cc
  16. platform_windows.cc
  17. README.md
  18. trace_writer_base.cc
  19. traced_proto_unittest.cc
  20. traced_value.cc
  21. traced_value_unittest.cc
  22. tracing.cc
  23. tracing_policy.cc
  24. track.cc
  25. track_event_category_registry.cc
  26. track_event_legacy.cc
  27. track_event_state_tracker.cc
  28. 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++11 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.