summaryrefslogtreecommitdiffstats
path: root/util/bin
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2012-06-08 20:34:23 +0200
committermakefu <github@syntax-fehler.de>2012-06-08 20:34:23 +0200
commita0321c82c7f80d1052108c4a1602b775799e4593 (patch)
tree4a9af394716216cf3e56dd022b8f0d30746efac6 /util/bin
parentdd1ba866c0f93500e1d3e4876fc75955be9d976a (diff)
parent6046373ce92a9c9856d828b37cda28af437e36be (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'util/bin')
-rwxr-xr-xutil/bin/statsc4
-rwxr-xr-xutil/bin/timer14
2 files changed, 18 insertions, 0 deletions
diff --git a/util/bin/statsc b/util/bin/statsc
new file mode 100755
index 00000000..ff86ccb8
--- /dev/null
+++ b/util/bin/statsc
@@ -0,0 +1,4 @@
+#!/bin/sh
+# see https://github.com/etsy/statsd for syntax
+[ $# -eq 0 ] && echo "usage: $0 MESSAGE"
+echo "$1" | nc -w 1 -u 127.0.0.1 8125
diff --git a/util/bin/timer b/util/bin/timer
new file mode 100755
index 00000000..0ccf514a
--- /dev/null
+++ b/util/bin/timer
@@ -0,0 +1,14 @@
+#!/bin/bash
+curr=$(date '+%s%N')
+etime=${curr:0:${#curr}-6}
+if [[ $# -eq 0 ]];then
+ echo $etime
+else
+ [ "$1" == "-h" -o "$1" == "--help" ] && \
+ echo "usage: $0 [start_ms]" && \
+ echo " if no start_ms is given, return the currentime" && \
+ echo " if start_ms is given, return the difference" && exit 0
+ stime=$1
+ [[ -z "$stime" ]] && stime=$etime
+ echo $((etime - stime))
+fi