Skip to main content

chrometrace

A Python library for creating Chrome Trace Viewer files. The Chrome Trace Viewer can be opened in Chromium-based browsers (e.g. Google Chrome, Microsoft Edge, Chromium, ...) by entering chrome://tracing into the address bar.

The trace event format and types are defined in this document.

Installation

Install the package from PyPi using the following command.

pip install chrometrace

Usage

import chrometrace

# Create the trace sink as a context manager
with chrometrace.TraceSink("trace.json") as trace_sink:
    # Create a process tracer called myapp from the trace sink
    myapp_tracer = trace_sink.process_tracer("myapp", process_id=1337)
    # Create a thread tracer for the renderer thread from the process tracer
    renderer_thread_tracer = myapp_tracer.thread_tracer("RendererThread", 1)

    # Write a complete event at 10 us taking 1000 us with the name my_function
    renderer_thread_tracer.complete("my_function", timestamp_us=10, duration_us=1000)

Supported trace formats

Currently only the JSON Array Format is supported due to its simplicity. Support for the JSON Object Format might be added in the future.

Supported trace events

  • Duration Events
    • Begin
    • End
  • Complete Events
  • Instant Events
    • With different scopes
  • Counter Events
  • Async Events
  • Flow Events
  • Metadata Events
    • Name process / thread
    • Define process / thread sort index
    • Process labels
  • Sample Events
  • Object Events
  • Mark Events
  • Clock Sync Events
  • Context Events

Metadata

Release files for chrometrace 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chrometrace 0.2.1
File Size Uploaded
chrometrace-0.2.1.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chrometrace 0.2.1
File Interpreter ABI Platform
chrometrace-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / chrometrace-0.2.1.tar.gz

Download URL chrometrace-0.2.1.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
81fb4d65b2bf547b1a7ebd2ad0cc5f7ee358d1384cbbe61f11ad199df56040ed
BLAKE2b-256 checksum
How to use checksums
8bd4717a3a223fe22d56f41954b8f79f90b269ffb0092656e8aa1f60599bc121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.22

Release files / chrometrace-0.2.1-py3-none-any.whl

Download URL chrometrace-0.2.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e7c3b5acd95f48a1c745533c642cf4b813b75261fbc3d50462c6a8e1347811e
BLAKE2b-256 checksum
How to use checksums
baea84b2d412d0b7573c0d5291508c8127bfc078d40035201a9d25ec8be30c85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page