npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

v8-analytics

v1.3.7

Published

v8 cpu & heap-memory profiler log analystics

Downloads

25

Readme

中文版

npm version Package Quality license

v8-analytics/v8-cpu-analysis

Analysis the cpu & heap-memory log file which created by v8-profiler & heapdump,it can:

  • show you functions which are optimized failed by v8 engine
  • show you functions which exectime greater than your expected
  • show you suspicious memory leak point

Why Two Names?

v8-analytics is completely equivalent to v8-cpu-analysis, there is no difference between them.

Beacuse I want to introduce v8 engine's heap-memory analytics, so I think cpu in package name is not suitable. More, to be compatible with before, I chose them published comletely equivalent.

Installation

For Global

$ npm install v8-analytics -g

or

$ npm install v8-cpu-analysis -g

For Embedded JS code

$ npm install v8-analytics

or

$ npm install v8-cpu-analysis

Test

if you install -g, try:

//test bailout
$ va test bailout
$ va test bailout --only
//test timeout
$ va test timeout
$ va test timeout 200
$ va test timeout 200 --only
$ va test leak

va test bailout --only can list you all functions which are deoptimized, and it's deoptimization reason.

va test timeout 200 --only can list you all function which exectime > 200ms.

va test leak cans list you suspicious leak point in your project.

Quick Start

You can use this at the command line or embedded in your js code

I. Command Line

Find Function Bailout Reason

The xxx.cpu.json file created by v8-profiler:

$ va bailout xxx.cpu.json

This will list all Function, and turn the deoptimized function to red. You can also use like that:

$ va bailout xxx.cpu.json --only

This will only list the deoptimized functions.

Find Funtion Exectime Greater Than Expected

$ va timeout xxx.cpu.json

This will list all Function, and their exectime

$ va timeout xxx.cpu.json 200

This will list all Function ,and turn the functions which exectime > 200ms to red.

$ va timeout xxx.cpu.json 200 --only

This will only list the functions which exectime > 200ms.

Find suspicious memory leak point

$ va leak xxx.mem.json

This will show you suspicous leak ponit in your node.js project.

II. Embedded JS Code

'use strict';
const fs = require('fs');
const v8Analytics = require('v8-analytics');
//or you can use following, they're equival
//const v8Analytics = require('v8-cpu-analysis');

//list all js function and it's execTime
const json = JSON.parse(fs.readFileSync('./test.cpu.json'));
const str = v8Analytics(json);
console.log(str);

//list you heap memory info
const json = JSON.parse(fs.readFileSync('./test.mem.json'));
const {leakPoint, heapMap, statistics} = analysisLib.memAnalytics(allData)