Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

usb-power-profiling

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

usb-power-profiling

Make USB power meters usable with the Firefox Profiler

  • 1.1.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.3K
increased by32.81%
Maintainers
1
Weekly downloads
 
Created
Source

Make the data from USB power meters usable in the Firefox Profiler.

Quick start

The following instructions will start a server on localhost:2121.

git clone https://github.com/fqueze/usb-power-profiling.git
cd usb-power-profiling
npm i
node usb-power-profiling.js

Then open the Firefox Profiler UI to load the data from the meter.

External power profiling in the Firefox Profiler

In Firefox 121 or later:

  • in about:config, set the devtools.performance.recording.power.external-url preference to http://localhost:2121/power.
  • use the 'power' preset (or any configuration that uses the 'power' feature) when starting the profiler.
  • When capturing the profile, the Firefox Profiler will automatically fetch additional power tracks and add them to the profile.

Seeing a profile containing only the data from the USB power meter

Load http://localhost:2121/profile in the Firefox Profiler.

HTTP API

  • GET /profile will return a profile containing all the data since the script has started. You can view it by loading it in the Firefox Profiler.
  • GET /power?start=<start timestamp in ms>&end=<end timestamp in ms> returns only a power track to be added into a profile from the Gecko Profiler. The start timestamp should be profile.meta.startTime + profile.meta.profilingStartTime from the profile and the end timestamp should be profile.meta.startTime + profile.meta.profilingEndTime.

Supported devices

Power meters known to work

The example profiles are taken using a USB light, first keeping the light off for a while to record noise from the power meter, then turning the light on at different levels of brightness for about 5s, and finally turning the light off again.

BrandModelExample profileMin interval between samplesNotes
ChargerLab Power-ZFL001 Superhttps://share.firefox.dev/4714rQQ32ms
ChargerLab Power-ZKM001Prohttps://share.firefox.dev/4ag8xqN2ms
ChargerLab Power-ZKT002https://share.firefox.dev/3RkPsvf1msSamples contain timestamps in µs, and sampling is driven by the power meter, making the sampling rate very consistent (no degradation of the data when the USB bus is busy)
ChargerLab Power-ZKM003Chttps://share.firefox.dev/3Rg6z151msSampling driven by the computer, causing overhead on the computer and relying on the USB communication being smooth.
Shizuku YK-LabYK001See Power-Z KT002. Alternative names: AVHzY CT-3, Power-Z KT002, or ATORCH UT18.
Shizuku YK-LabYK003CSee AVHzY C3.
AVHzYCT-3See Power-Z KT002.
AVHzYC3https://share.firefox.dev/41BVhcf1msSamples contain timestamps in µs, and sampling is driven by the power meter, making the sampling rate very consistent (no degradation of the data when the USB bus is busy)
AVHzYTC66C (RD)See RuiDeng TC66C
FNIRSIC1https://share.firefox.dev/4asQhLh10msSignificant power use changes are smoothed over 500ms.
FNIRSIFNB48Shttps://share.firefox.dev/3RjtVTl10msSignificant power use changes are smoothed over 120ms.
RuiDengTC66Chttps://share.firefox.dev/3v4AvFV80msSampling rate depends on how much data is displayed on the power meter's screen. With the full display, 100ms is the minimum interval between samples. With only the main 3 values displayed, 90ms is in the minimum between samples, with a static screen (eg. settings) the minimum interval is 80ms. Significant power changes take up to 500ms to stabilize (with a few samples showing only a part of the change).
WITRNC5https://share.firefox.dev/41nqAaQ10msSamples contain timestamps in ms.
ATORCHACD15Phttps://share.firefox.dev/3SIWpGS1sVery low sampling rate.
YZXStudio1280Ehttps://share.firefox.dev/3Wr9HeW250msLow sampling rate. Significant power changes take up to 500ms (2 samples) to stabilize. Seems to have a low level of noise, making it possible to see a difference between low power values ( <10mW) and 0.

Power meters likely to work

Compatibility with these devices has not been verified, but they are likely to either "just work", or work with a trivial adjustment to the code (eg. tweak a USB product id).

BrandModelNotes
ChargerLab Power-ZKM002CSame protocol as the KM003C.
FNIRSIFNB48Expected to use the same protocol as the FNIRSI C1.
FNIRSIFNB48PExpected to be the same as the FNIRSI FNB48S in a different package.
FNIRSIFNB58Expected to use the same protocol as the FNIRSI FNB48S.
RuiDengTC66Expected to use the same protocol as the TC66C.
WITRNA2Expected to use the same protocol as the C5.
WITRNA2LExpected to use the same protocol as the C5.
WITRNA2CExpected to use the same protocol as the C5.
WITRNU3Expected to use the same protocol as the C5.
WITRNU3LExpected to use the same protocol as the C5.
WITRNC4 / C4LExpected to be the same as the C5 with lower data precision.
ATORCHC13PExpected to be the same as the ACD15P.

FAQs

Package last updated on 17 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc