We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20e9fd4 commit 6783e71Copy full SHA for 6783e71
scripts/timer.sh
@@ -1,12 +1,24 @@
1
#!/bin/bash
2
3
+function now_ms() {
4
+ if [[ "$(uname)" == Darwin ]] ; then
5
+ if [[ ! -z $(which gdate) ]] ; then
6
+ gdate "+%s.%N"
7
+ else
8
+ python -c 'import time; print time.time()'
9
+ fi
10
11
+ date "+%s.%N"
12
13
+}
14
+
15
TIMINGS_FILE=/tmp/osrm.timings
16
NAME=$1
17
CMD=${@:2}
-START=$(date "+%s.%N")
18
+START=$(now_ms)
19
/bin/bash -c "$CMD"
-END=$(date "+%s.%N")
20
+END=$(now_ms)
21
TIME="$(echo "$END - $START" | bc)s"
-NEW_ENTRY="$NAME\t$TIME\t$(date -Iseconds)"
22
+NEW_ENTRY="$NAME\t$TIME\t$(date +%FT%X)"
23
24
echo -e "$NEW_ENTRY" >> $TIMINGS_FILE
0 commit comments