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

@onekeyfe/react-native-perf-stats

v3.0.31

Published

react-native-perf-stats

Readme

@onekeyfe/react-native-perf-stats

Native CPU, RAM, UI-FPS and JS-FPS sampler for React Native, with an optional draggable on-screen overlay. Built on Nitro Modules — the sampler runs on a dedicated background thread so the overlay keeps updating even when the JS thread is frozen.

  • Android: HandlerThread + /proc/self/stat (CPU ticks) + /proc/self/statm (RSS) + Choreographer.FrameCallback (UI FPS); overlay attached via WindowManager to the current Activity (no SYSTEM_ALERT_WINDOW permission).
  • iOS: GCD dispatch source + task_info (phys_footprint) + CADisplayLink (UI FPS); overlay added as a UILabel on the key UIWindow.
  • JS FPS: opt-in JS-side requestAnimationFrame ticker that pushes its per-second count to native via setJsFpsHint. Started by startJsFpsTracker().

Installation

yarn add @onekeyfe/react-native-perf-stats react-native-nitro-modules

react-native-nitro-modules is a required peer dependency.

Usage

import { ReactNativePerfStats } from '@onekeyfe/react-native-perf-stats';

// Start sampling at 1 Hz. Idempotent — calling again just updates the interval.
// Also kicks off the JS-side rAF tracker so PerfSample.jsFps is populated.
ReactNativePerfStats.start(1000);

// Show the floating overlay (drag to reposition).
ReactNativePerfStats.showOverlay();

// One-shot read without touching the overlay timer.
const sample = await ReactNativePerfStats.sample();
console.log(sample);
// { cpu: 12.3, rss: 187654144, uiFps: 59, jsFps: 60, timestamp: 1730000000000 }

// Tear down. Also stops the JS-side rAF tracker.
ReactNativePerfStats.hideOverlay();
ReactNativePerfStats.stop();

PerfSample

| field | unit | notes | | ----------- | --------------------- | ------------------------------------------------------------------------------------------------------ | | cpu | percent of one core | (Δcpu / Δwall) * 100. May exceed 100 on multi-core saturation. First sample after launch is 0. | | rss | bytes | iOS phys_footprint, Android VmRSS. | | uiFps | frames per second | UI thread frame rate over the last sampling window. 0 until at least one window has elapsed. | | jsFps | frames per second | JS thread rAF count. 0 unless startJsFpsTracker() has been called and reported at least once. | | timestamp | ms since unix epoch | Wall-clock at sample time. |

API

  • start(intervalMs: number): void — minimum interval is clamped to 200 ms. Also starts the JS-side rAF tracker (matched to intervalMs) so jsFps flows automatically.
  • stop(): void — stops the JS-side tracker, the native sampler, and hides the overlay.
  • showOverlay(): void / hideOverlay(): void — overlay shows -- until start runs.
  • sample(): Promise<PerfSample> — runs off the JS thread, shares baseline with the overlay sampler.
  • setJsFpsHint(fps: number): void — low-level escape hatch; normally driven by the auto-managed tracker.
  • startJsFpsTracker(reportIntervalMs?: number): void / stopJsFpsTracker(): void — manual control of the JS-side rAF tracker. Useful if you want JS FPS without enabling the native sampler. Calling startJsFpsTracker with a different reportIntervalMs while running restarts the loop with the new interval.

Anomaly logging

While the sampler is running, the native side emits a warn to @onekeyfe/react-native-native-logger (OneKeyLog.warn, tag PerfStats) whenever a metric stays over its threshold for 5 consecutive samples. Each category has an independent 30 s cooldown so a sustained spike produces one log every 30 s rather than one per sample.

| metric | threshold | | ------ | ---------------- | | CPU | ≥ 150 % | | RSS | ≥ 800 MB | | UI FPS | ≤ 45 fps (and > 0) | | JS FPS | ≤ 30 fps (and > 0) |

One-off sample() calls do not trip this path — only the periodic timer started by start() does.

License

MIT