TraceLib
This library provides a set of models from the devtools-frontend
code base in order to parse trace log files.
Note: This is early development and not ready to be consumed yet!
Installation
To install the package to your project, run:
$ npm install --save tracelib
Usage
getSummary
Fetch total time-durations of scripting, rendering, painting from tracelogs.
import Tracelib from 'tracelib'
import JANK_TRACE_LOG from './jankTraceLog.json'
const tasks = new Tracelib(JANK_TRACE_LOG)
const summary = tasks.getSummary()
console.log(summary)
getWarningCounts
Fetch amount of forced synchronous layouts and styles as well as long recurring handlers.
import Tracelib from 'tracelib'
import JANK_TRACE_LOG from './jankTraceLog.json'
const tasks = new Tracelib(JANK_TRACE_LOG)
const counts = tasks.getWarningCounts()
console.log(counts)
getFPS
Fetch frames per second.
import Tracelib from 'tracelib'
import JANK_TRACE_LOG from './jankTraceLog.json'
const tasks = new Tracelib(JANK_TRACE_LOG)
const fps = tasks.getFPS()
console.log(fps)
getMemoryCounters
Fetch data for JS Heap, Documents, Nodes, Listeners and GPU Memory from tracelogs.
import Tracelib from 'tracelib'
import JANK_TRACE_LOG from './jankTraceLog.json'
const tasks = new Tracelib(JANK_TRACE_LOG)
const memoryInfo = tasks.getMemoryCounters()
console.log(memoryInfo)
getDetailStats
Fetch data (timestamp and values) of scripting, rendering, painting from tracelogs.
import Tracelib from 'tracelib'
import JANK_TRACE_LOG from './jankTraceLog.json'
const tasks = new Tracelib(JANK_TRACE_LOG)
const detail = tasks.getDetailStats()
console.log(detail)
Test
To test this package, run:
$ npm run test