Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chrome-timeline-logger

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-timeline-logger

A NodeJs timeline logger tool for generating timeline json files for viewing in the chrome browser

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Chrome Timeline Logger

Build Status NPM version Dependency Status Gittip donate button Bitdeli Badge

This logger helps generates a timeline JSON file that's compatible with the Chrome Dev Tools timeline viewer

Installation

npm install chrome-timeline-logger

Usage

var timeline = require('chrome-timeline-logger');
var builder = new timeline.TimelineBuilder();

// create a Program record
var programEvent = builder.startEvent("Program");

//	do some stuff
for (index = _i = 0; _i < 10; index = ++_i) {

  // create a TimeStamp record
  var event = builder.startEvent("TimeStamp", {message: "hi mum " + index + "!"});
  
  // set the memory useage for this event
  event.usedHeapSize = process.memoryUsage().heapUsed;

  // demonstrates how to set the documents count in the counters section
  event.counters = { documents: index }
  
  console.log("some work load");
  
  // end the TimeStamp record
  builder.endEvent();
}

// end the Program record
builder.endEvent();

var logger = new timeline.TimelineLogger();

logger.save("./test.json", programEvent);

  • Best way to discover supported events and their data is to make a recording in the timeline tool and examine it's output ;)
  • I've also made an attempt to list them here TimelineRecordTypes

Above Example Output

image

API

######TimelineLogger

nametypeargsdescription
save()methodstring filepath, timelineRecordList[], onComplete()saves an array of timeline records to a file specified by the filepath
saveSync()methodstring filepath, timelineRecordList[]Synchronous version of save
versionstringAppears at the top of each saved timeline json file
######TimelineBuilder
nametypeargsdescription
startEvent()methodstring type, [object data]starts a timeline event. Types are defined in TimelineRecordTypes
endEvent()methodnoneends the currently started timeline event.

######TimelineRecord

nametypeargsdescription
start()methodnonesets startTime to Date.now()
end()methodnonesets endTime to Date.now()
startTimenumber
endTimenumber
childrenTimelineRecord[]
dataobject
frameIdnumber
usedHeapSizenumber
usedHeapSizeDeltanumber
countersobject
stackTraceobject

History

You can discover the history inside the History.md file

Contributing

You can discover the contributing instructions inside the Contributing.md file

License

Licensed under the incredibly permissive MIT License
Copyright © 2013+ Stringz Solutions Ltd
Copyright © 2013+ Peter Flannery

FAQs

Package last updated on 24 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc