Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- var overlay, lastCount, lastTime, timeoutFun;
- overlay = document.createElement('div');
- overlay.style.background = 'rgba(0, 0, 0, .7)';
- overlay.style.bottom = '0';
- overlay.style.color = '#fff';
- overlay.style.display = 'inline-block';
- overlay.style.fontFamily = 'Arial';
- overlay.style.fontSize = '10px';
- overlay.style.lineHeight = '12px';
- overlay.style.padding = '5px 8px';
- overlay.style.position = 'fixed';
- overlay.style.right = '0';
- overlay.style.zIndex = '1000000';
- overlay.innerHTML = 'FPS: -';
- document.body.appendChild(overlay);
- lastCount = window.mozPaintCount;
- lastTime = performance.now();
- timeoutFun = function () {
- var curCount, curTime;
- curCount = window.mozPaintCount;
- curTime = performance.now();
- overlay.innerHTML = 'FPS: ' + ((curCount - lastCount) / (curTime - lastTime) * 1000).toFixed(2);
- lastCount = curCount;
- lastTime = curTime;
- setTimeout(timeoutFun, 1000);
- };
- setTimeout(timeoutFun, 1000);
- }())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement