Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. (function () {
  2. var overlay, lastCount, lastTime, timeoutFun;
  3.  
  4. overlay = document.createElement('div');
  5. overlay.style.background = 'rgba(0, 0, 0, .7)';
  6. overlay.style.bottom = '0';
  7. overlay.style.color = '#fff';
  8. overlay.style.display = 'inline-block';
  9. overlay.style.fontFamily = 'Arial';
  10. overlay.style.fontSize = '10px';
  11. overlay.style.lineHeight = '12px';
  12. overlay.style.padding = '5px 8px';
  13. overlay.style.position = 'fixed';
  14. overlay.style.right = '0';
  15. overlay.style.zIndex = '1000000';
  16. overlay.innerHTML = 'FPS: -';
  17. document.body.appendChild(overlay);
  18.  
  19. lastCount = window.mozPaintCount;
  20. lastTime = performance.now();
  21.  
  22. timeoutFun = function () {
  23. var curCount, curTime;
  24.  
  25. curCount = window.mozPaintCount;
  26. curTime = performance.now();
  27. overlay.innerHTML = 'FPS: ' + ((curCount - lastCount) / (curTime - lastTime) * 1000).toFixed(2);
  28. lastCount = curCount;
  29. lastTime = curTime;
  30. setTimeout(timeoutFun, 1000);
  31. };
  32.  
  33. setTimeout(timeoutFun, 1000);
  34. }())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement