strong-trace-waterfalltransform

Transform waterfall trace data into other useful data structures

Usage no npm install needed!

<script type="module">
  import strongTraceWaterfalltransform from 'https://cdn.skypack.dev/strong-trace-waterfalltransform';
</script>

README

strong-trace-waterfalltransform

Transform functions that take raw waterfall trace formats and transform them into other useful data structures.

Install

npm install --save strong-trace-waterfalltransform`

Usage

var xform = require('strong-trace-waterfalltransform')

API

xform.graph(waterfall)

Convert a raw waterfall trace into a 'nodes, links' structure with the following schema:

{
  "nodes": [{
    "id": "some id",
    "duration": "in microseconds",
    "child_duration": "in microseconds",
    "exclusive_duration": "duration - child_duration"
    "num_calls": "number of calls"
  }],
  "links": [{
    "id": "source~target",
    "source": "id",
    "target": "id",
    "num_calls": "number of calls",
    "total_delay": "in microseconds"
  }]
}

xform.enhanceWaterfall(waterfall, options)

Options is an object with the following fields:

{
    summaryFactor: 1000  // this controls the summarization factor.  Andything smaller than 1/summaryFactor in size will be aggregated
}

Performs an inplace enhancement of the waterfall trace data structure. The following fields will be added:

{
  "waterfalls": [
    "maxEnd":           //the maximum 'end' value in this waterfall
    "summary": {        //a summary view of the waterfall
      "subSegments": [
        {

        }
      ]
    },
    "fnSegs": []       //array referencing just the function segments
    "waitSegs": []     //array referencing just the wait segments
    "segments": [
      {
        "id":          //a synthetic id for the segment
        ...
        "subSegments": [
          {
            "id":      //a synthethic id for the subsegment
            "start": 0
            "end": 0
            "exclusive": 0
            "parent":   //points back to the parent segment
          }
        ]
      }
    ]
  ]
}