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 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-staphylus

v0.0.16

Published

Another node profiling tool

Downloads

38

Readme

Staphylus

Staphylus is a lightweight framework for trace probing and performance profiling.

Installation

Using npm:

$ npm install --save node-staphylus
$ npm install -g staphylus-cli

How It Works

By inserting traces in the code, it enables the profiler to collect runtime information, which will then be transferred via sockets to the client for printing and visualizing. Here is a simple demo.

Traces

Here is a list of available trace types.

  • Single Trace

    single(name, ...args)

    Used for single entry probes. Optionally users can append a list of arguments for debugging.

    • name - Required. Name of the trace
    • args - Optional. List of custom arguments

    Example:

    function add(x, y) {
        const sum = x + y;
        profiler.single('Addition', x, y, sum);
        return sum;
    }
  • Interval Trace

    begin(name, ...args)
    end(name, ...args)

    Used for interval probes. The begin and end trace will be coupled by the trace name to provide useful information like time duration. Optionally users can append a list of arguments for debugging.

    • name - Required. Name of the trace
    • args - Optional. List of custom arguments

    Example:

    // Asynchronously
    function readDir(path) {
        // Add path to the begin argument list
        profiler.begin('ReadDir', path);
          
        // Use fs to read directory synchronously
        fs.readdir(path, function(err, content) {
            // Add error, directory content to the end argument list
            profiler.end('ReadDir', err, content.toString('utf-8'));
        });
    }
    
    // Synchronously
    function readDirSync(path) {
        // Add path to the begin argument list
        profiler.begin('ReadDirSync', path);
          
        // Use fs to read dir synchronously
        var content = fs.readdirSync(path);
    
        // Add directory content to the end argument list
        profiler.end('ReadDirSync', content.toString('utf-8'));
    }
  • Async Function Trace

    async(name, fn, ...args)

    Used for async function. It is similar to the async function example above but provides a more convenient way to embed interval traces.

    It assumes that the last argument of fn is the callback function, and the end trace will be embedded right below the callback is fired. If the last argument is not a function, the profiler will treat it as a sync function trace (see below).

    • name - Required. Name of the trace
    • fn - Required. Name of the async function
    • args - Optional. List of function arguments. If the async function does not require any arguments, then leave it blank.

    Example:

    profiler.async('ReadDir', fs.readdir, '/tmp', function(err, data) {
         console.log('err', err);
         console.log('data', data);
     });
  • Sync Function Trace

    sync(name, fn, ...args)

    Used for sync function. It is similar to the sync function example above but provides a more convenient way to embed interval traces.

    sync will preserve the original return value of the function and add it to the end argument list.

    • name - Required. Name of the trace
    • fn - Required. Name of the async function
    • args - Optional. List of function arguments. If the async function does not require any arguments, then leave it blank.

    Example:

    var content = profiler.sync('ReadDirSync', fs.readdirSync, '/tmp');

Options

Here is a list of options that can be used to configure profiler.

  • server.port

    Port for sending and receiving trace buffer. 3030 by default.

Example:

const options = {
    server: {
        port: 8080,
    },
};
const profiler = new Profiler(options);

Credits

Made possible by protobuf, socket.io. Inspired by Ariadne.