Browse files

round non-ints to timing fun

  • Loading branch information...
1 parent 733f78f commit e9e390bb6c8b225267d5f08e48b9821c171f259d @RJ RJ committed May 23, 2011
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/estatsd.erl
View
13 src/estatsd.erl
@@ -8,14 +8,19 @@
-define(SERVER, estatsd_server).
+% Convenience: just give it the now() tuple when the work started
+timing(Key, StartTime = {_,_,_}) ->
+ Dur = erlang:round(timer:now_diff(erlang:now(), StartTime)/1000),
+ timing(Key,Dur);
+
% Log timing information, ms
timing(Key, Duration) when is_integer(Duration) ->
gen_server:cast(?SERVER, {timing, Key, Duration});
-% Convenience: just give it the now() tuple when the work started
-timing(Key, StartTime = {_,_,_}) ->
- Dur = erlang:round(timer:now_diff(erlang:now(), StartTime)/1000),
- timing(Key,Dur).
+timing(Key, Duration) ->
+ gen_server:cast(?SERVER, {timing, Key, erlang:round(Duration)}).
+
+
% Increments one or more stats counters

0 comments on commit e9e390b

Please sign in to comment.