Skip to content

dietrich-stein/stats.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stats.js

This repo is a customized fork of drecom/stats.js.

The parent of this repo is a customized fork of mrdoob/stats.js.

What changed in this fork?

customized2.png

  • Updated Babel and rollup
  • Converted module to ESM syntax
  • Using an object for configuration
  • Added color options
  • Changed to line style for FPS graph
  • Modified the default graph colors
  • Removed alert coloring
  • Removed custom graphs

What changed in the parent fork?

  • Combined all the stats.js monitors into one.
  • Added getters of various parameters.
  • Added text display area.
  • Reduced drawing load. (but, reduced drawing frequency. Optional changeable.)

customized.png

  • FPS Frames rendered in the last second. The higher the number the better.
  • MS Maximum number of milliseconds between graph drawing. The lower the number the better.
  • MB MBytes of allocated js memory. (Enabled by default in Chrome for desktop 69 and later)

Usage

All settings are optional. The defaults are shown below.

var stats = new Stats({
  maxFps: 60,
  maxMb: 100,
  drawInterval: 1000,
  containerStyle: 'position:fixed;top:0;left:0;opacity:0.9;z-index:10000',
  canvasStyle: 'width:160px;height:96px',
  showFps: true,
  showMs: true,
  showMb: true,
  frameColor: '#000022',
  graphColor: '#112244',
  fpsColor: '#ffffff',
  fpsTextColor: '#ffffff',
  msColor: '#00ffff',
  msTextColor: '#00ffff',
  mbColor: '#ff00ff',
  mbTextColor: '#ff00ff'
});

document.body.appendChild(stats.dom);

function animate() {
    stats.begin();
    // monitored code goes here
    stats.end();
    requestAnimationFrame(animate);
}

animate();

About

JavaScript Performance Monitor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%