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

@jarred/cpu

v1.0.1

Published

Process resource usage measurement utility

Downloads

50

Readme

A simple, readable alternative to the Unix time command.

$ cpu bun --print '123'
123
┌─────────┬──────────────┬─────────────┬─────────────┐
│  0.01s  │  0.01s user  │  0.00s sys  │  20 MB mem  │
└─────────┴──────────────┴─────────────┴─────────────┘

This tool runs commands and shows their execution time and memory usage in an easy-to-read format. It works just like the standard time command, but with a cleaner display.

Installation

# Install globally
bun install -g @jarred/cpu

# Or use directly
bunx @jarred/cpu <command>

Usage

# Basic usage
cpu sleep 1
┌─────────┬──────────────┬─────────────┬────────────┐
│  1.00s  │  0.00s user  │  0.00s sys  │  2 MB mem  │
└─────────┴──────────────┴─────────────┴────────────┘

Verbose output

# With verbose output
cpu -v node -e "console.log('Hello')"
┌─────────┬──────────────┬─────────────┬─────────────┐
│  0.03s  │  0.02s user  │  0.01s sys  │  30 MB mem  │

Detailed metrics:
  Time:
    Total:      0.035s
    User CPU:   0.02s (57.5% of total)
    System CPU: 0.01s (28.8% of total)
  Memory:
    Peak:       30 MB
    System:     64 GB total (0.05% used)
  Process:
    Context switches: 62 (voluntary: 1, involuntary: 61)
    IO operations:    in: 0, out: 0
    Exit code:        0
└─────────┴──────────────┴─────────────┴─────────────┘

More examples:

# Time a script
cpu ./my-script.sh

# Compare Node.js and Bun
cpu node -e "console.log('Hello world')"
cpu bun -e "console.log('Hello world')"

# Time a build process
cpu npm run build

Comparison with time command

Standard time command output:

real    0m1.007s
user    0m0.003s
sys     0m0.003s

cpu command output:

┌─────────┬──────────────┬─────────────┬─────────────┐
│  0.01s  │  0.01s user  │  0.00s sys  │  20 MB mem  │
└─────────┴──────────────┴─────────────┴─────────────┘

Differences:

  • Includes memory usage
  • Uses a simple table format
  • Has a verbose mode for additional details
  • Adds basic color coding when supported

How it works

This tool uses Bun's resourceUsage() API, which accesses the same underlying getrusage system call that the standard Unix time command uses. This means you get the same accurate metrics, just displayed in a more readable format. The implementation is efficient with minimal overhead to the process being measured.

Options

  • -v, --verbose: Show additional metrics
  • -h, --help: Show help message
  • --version: Show version information

Output explained

Standard output shows:

  • Total execution time
  • User CPU time
  • System CPU time
  • Peak memory usage

Verbose output (-v) adds:

  • CPU percentages
  • Memory usage percentages
  • Context switch counts
  • I/O operation counts
  • Process exit code

Development

# Clone the repository
git clone https://github.com/jarred/cpu.git
cd cpu

# Install dependencies
bun install

# Run locally
bun run index.ts <command>

License

MIT © Jarred Sumner