# 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](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU).
## Installation
Install the package from PyPi using the following command.
```sh
pip install chrometrace
```
## Usage
```python
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
* [x] Duration Events
* Begin
* End
* [x] Complete Events
* [x] Instant Events
* With different scopes
* [x] Counter Events
* [ ] Async Events
* [ ] Flow Events
* [x] Metadata Events
* Name process / thread
* Define process / thread sort index
* Process labels
* [ ] Sample Events
* [ ] Object Events
* [ ] Mark Events
* [ ] Clock Sync Events
* [ ] Context Events
Raw data
{
"_id": null,
"home_page": "https://github.com/jonasehrlich/chrometrace",
"name": "chrometrace",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "trace,chromium",
"author": "Jonas Ehrlich",
"author_email": "jonas.ehrlich@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/58/99/f4dc4595f733809f9a4ad02e5712ff792c435fe3aed8f254480f0c20f7ef/chrometrace-0.1.2.tar.gz",
"platform": null,
"description": "# chrometrace\n\nA Python library for creating Chrome Trace Viewer files. The Chrome Trace Viewer can be opened in\nChromium-based browsers (e.g. Google Chrome, Microsoft Edge, Chromium, ...) by entering _chrome://tracing_ into the\naddress bar.\n\nThe trace event format and types are defined in\n[this document](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU).\n\n## Installation\n\nInstall the package from PyPi using the following command.\n\n```sh\npip install chrometrace\n```\n\n## Usage\n\n```python\nimport chrometrace\n\n# Create the trace sink as a context manager\nwith chrometrace.TraceSink(\"trace.json\") as trace_sink:\n # Create a process tracer called myapp from the trace sink\n myapp_tracer = trace_sink.process_tracer(\"myapp\", process_id=1337)\n # Create a thread tracer for the renderer thread from the process tracer\n renderer_thread_tracer = myapp_tracer.thread_tracer(\"RendererThread\", 1)\n\n # Write a complete event at 10 us taking 1000 us with the name my_function\n renderer_thread_tracer.complete(\"my_function\", timestamp_us=10, duration_us=1000)\n```\n\n## Supported trace formats\n\nCurrently only the _JSON Array Format_ is supported due to its simplicity. Support for the _JSON Object Format_ might be\nadded in the future.\n\n## Supported trace events\n\n* [x] Duration Events\n * Begin\n * End\n* [x] Complete Events\n* [x] Instant Events\n * With different scopes\n* [x] Counter Events\n* [ ] Async Events\n* [ ] Flow Events\n* [x] Metadata Events\n * Name process / thread\n * Define process / thread sort index\n * Process labels\n* [ ] Sample Events\n* [ ] Object Events\n* [ ] Mark Events\n* [ ] Clock Sync Events\n* [ ] Context Events\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for Chrome Trace Viewer files",
"version": "0.1.2",
"split_keywords": [
"trace",
"chromium"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ea9942488aec394bf8130b3f0d289b72bfa633a20f2a22deb5c5b8055d5560e7",
"md5": "306100cba9123ff3c2e6d5e137c8018c",
"sha256": "b8fbe1f3af2867c6209122d3964dedbdb5951a36fbee25f719b0541fdc065140"
},
"downloads": -1,
"filename": "chrometrace-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "306100cba9123ff3c2e6d5e137c8018c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 9027,
"upload_time": "2023-04-05T11:14:51",
"upload_time_iso_8601": "2023-04-05T11:14:51.645000Z",
"url": "https://files.pythonhosted.org/packages/ea/99/42488aec394bf8130b3f0d289b72bfa633a20f2a22deb5c5b8055d5560e7/chrometrace-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5899f4dc4595f733809f9a4ad02e5712ff792c435fe3aed8f254480f0c20f7ef",
"md5": "676a0b02d9fe4e28a5b6085cc247be15",
"sha256": "bf56b3115cd241dfd97c2311e223c833cccfe8e526452281f3285897855a001c"
},
"downloads": -1,
"filename": "chrometrace-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "676a0b02d9fe4e28a5b6085cc247be15",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 8795,
"upload_time": "2023-04-05T11:14:53",
"upload_time_iso_8601": "2023-04-05T11:14:53.776335Z",
"url": "https://files.pythonhosted.org/packages/58/99/f4dc4595f733809f9a4ad02e5712ff792c435fe3aed8f254480f0c20f7ef/chrometrace-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-05 11:14:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jonasehrlich",
"github_project": "chrometrace",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "chrometrace"
}