https://github.com/thlorenz/traceviewify
Converts .cpuprofile format to trace viewer JSON object format to allow analysing the data in chrome://tracing.
https://github.com/thlorenz/traceviewify
Last synced: 2 months ago
JSON representation
Converts .cpuprofile format to trace viewer JSON object format to allow analysing the data in chrome://tracing.
- Host: GitHub
- URL: https://github.com/thlorenz/traceviewify
- Owner: thlorenz
- License: mit
- Created: 2015-02-02T02:10:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-06T23:32:15.000Z (over 10 years ago)
- Last Synced: 2025-04-21T11:07:30.450Z (3 months ago)
- Language: JavaScript
- Homepage: http://thlorenz.github.io/traceviewify/
- Size: 2.23 MB
- Stars: 55
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# traceviewify [](http://travis-ci.org/thlorenz/traceviewify)
[](https://ci.testling.com/thlorenz/traceviewify)
Converts `.cpuprofile` format to trace viewer [JSON object
format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/edit#heading=h.q8di1j2nawlp) to allow analysing the data in chrome://tracing.```js
var traceviewify = require('traceviewify');
var cpuprofile = require('./fixtures/fibonacci.cpuprofile');var traceviewObjectFormat = traceviewify(cpuprofile);
```[live demo](http://thlorenz.github.io/traceviewify/)
## Screenshots
[](http://thlorenz.github.io/traceviewify/)
*The screenshot above shows [chrome://tracing](chrome://tracing) timeline and sunburst of traceviewified data*

*The screenshot above shows DevTools with `.cpuprofile` from which the traceview was generated*
## Usage
```
cat some.cpuprofile | traceviewify > trace.json
```Then load it into [chrome://tracing](chrome://tracing).
## Installation
npm install traceviewify
## DTrace
A [simple DTrace script](https://github.com/thlorenz/traceviewify/blob/master/tools/trace_entry_return.d) was also added
which generates trace viewer events. The resulting JSON can be directly imported into
[chrome://tracing](chrome://tracing).## API
traceviewify(cpuprofile, opts) → {Object}Converts given cpuprofile object to a trace viewer JSON object.
Parameters:
Name
Type
Argument
Description
cpuprofile
Object
as produced by Chrome DevTools or cpuprofilify
opts
Object
<optional>
Properties
Name
Type
Description
pid
number
sets process id
tid
number
sets thread id
cpu
number
sets CPU number
Returns:
trace viewer JSON object
Type
Object*generated with [docme](https://github.com/thlorenz/docme)*
## License
MIT