Last active
August 29, 2015 14:22
-
-
Save webcoyote/a0e11799a91a2d967083 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
| #!/bin/bash | |
| set -e # crash on errors | |
| set -u # crash on undefined variables | |
| set -o pipefail # crash when intermediate program in pipe fails | |
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| mcs "$SCRIPT_DIR/timer.cs" "$@" |
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
| using System; | |
| using System.Net; | |
| using System.Threading; | |
| using System.Diagnostics; | |
| public static class Program { | |
| public static void Main (string[] args) { | |
| var lastTicks = Environment.TickCount; | |
| var lastStop = Stopwatch.GetTimestamp(); | |
| while (true) { | |
| System.Threading.Thread.Sleep(5000); | |
| var currTicks = Environment.TickCount; | |
| var currStop = Stopwatch.GetTimestamp(); | |
| System.Console.WriteLine( | |
| "{0} {1:0.0} {2:0.0}", | |
| DateTime.UtcNow, | |
| (currTicks - lastTicks) / 1000f, | |
| (currStop - lastStop) / 1000f / 10000f | |
| ); | |
| lastTicks = currTicks; | |
| lastStop = currStop; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment