GithubHelp home page GithubHelp logo

node-profiler's Introduction

node-profiler

Access the V8 profiler from node.js - http://nodejs.org/

A word of advice

This module is for people who need fine-grained run-time control over the V8 profiler. You don't need it if all you want is wholesale profiling, simply start node with profiling enabled:

node --prof application.js

Read on, however, if you want to wield the arcane powers this module grants.

Compiling

Easy as pie. To build from source:

node-gyp configure build install

Or, if you have npm installed:

npm install profiler

Usage

In most cases you will want to start your application with the profiler in suspended animation.

node --prof --prof_lazy --log application.js

And inside your application:

var profiler = require('profiler');
//
// <here be code you don't want to profile>
//
profiler.resume();
//
// <performance critical code here>
//
profiler.pause();

This results in a v8.log being written to the current directory that you can process with the bundled nprof tool. Run sh tools/build-nprof to build it.

Advanced usage

You will sometimes want to run the garbage collector before profiling a performance critical section of code. Here is how you do it:

$ cat application.js
if (typeof gc === 'function') gc();
profiler.resume();
// ...
$ node --prof --prof_lazy --log --expose-gc application.js

node-profiler's People

Contributors

bnoordhuis avatar wmertens avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.