Created
February 2, 2015 19:52
-
-
Save Unitech/f3628f02857e0c2976e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var TIME_INTERVAL = 1000; | |
| var oldTime = process.hrtime(); | |
| var histogram = probe.histogram({ | |
| name : 'Loop delay', | |
| measurement : 'mean', | |
| unit : 'ms' | |
| }); | |
| setInterval(function() { | |
| var newTime = process.hrtime(); | |
| var delay = (newTime[0] - oldTime[0]) * 1e3 + (newTime[1] - oldTime[1]) / 1e6 - TIME_INTERVAL; | |
| oldTime = newTime; | |
| histogram.update(delay); | |
| }, TIME_INTERVAL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment