Registry / devops / tg4perfetto

tg4perfetto

JSON →
library0.0.6pypypi✓ verified 85d ago

A trace generator library for creating Perfetto trace files. Version 0.0.6, actively developed.

pip install tg4perfetto
INSTALL
IMPORT
SIG · TG4PERFETTO
T
tg4perfetto
devopspythonv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TraceGenerator
from tg4perfetto import TraceGenerator
Main class for building traces.

Create a simple Perfetto trace with one process, one thread, and a slice.

from tg4perfetto import TraceGenerator tg = TraceGenerator() tg.add_process(pid=42, name='my_process') tg.add_thread(pid=42, tid=100, name='worker') tg.add_slice(pid=42, tid=100, ts=0, dur=1000, name='compute') trace_bytes = tg.finalize() with open('trace.perfetto', 'wb') as f: f.write(trace_bytes)
Debug
Known issues
gotchaThe library does not validate timestamps; overlapping slices may lead to invalid traces.
fix
Ensure slices on the same thread have non-overlapping time ranges.
affects: all
deprecatedSome method signatures may change in future releases as the library is in early development (v0.0.x).
fix
Pin to a specific version and refer to changelog before upgrading.
affects: 0.0.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tg4perfetto'
Library not installed or installed in the wrong Python environment.
fix
Run 'pip install tg4perfetto' in the correct environment, or use 'python -m pip install tg4perfetto'.
AttributeError: module 'tg4perfetto' has no attribute 'TraceGenerator'
Outdated version where the class name differed, or typo in import.
fix
Upgrade to latest version: 'pip install --upgrade tg4perfetto' and ensure import is 'from tg4perfetto import TraceGenerator'.
Upgrade
Version history
0.0.6latest on PyPI · released Jun 22, 2025
Audit
Dependencies
perfettooptionalUsed for parsing and writing Perfetto trace protobufs
Agent activity
4 hits · last 30 days
node
4
Resources
tg4perfetto — pip install tg4perfetto · libregistry