change timed histogram updates to use timer:tc and return values of the called functions, more tests too
diff --git a/src/folsom_metrics.erl b/src/folsom_metrics.erl
index f739c62..623b18e 100644
--- a/src/folsom_metrics.erl
+++ b/src/folsom_metrics.erl
@@ -126,19 +126,16 @@
     folsom_ets:get_history_values(Name, Count).
 
 histogram_timed_update(Name, Fun) ->
-    Start = folsom_utils:now_epoch_micro(),
-    Fun(),
-    Stop = folsom_utils:now_epoch_micro(),
-    notify({Name, Stop - Start}).
+    {Time, Value} = timer:tc(Fun),
+    ok = notify({Name, Time}),
+    Value.
 
 histogram_timed_update(Name, Fun, Args) ->
-    Start = folsom_utils:now_epoch_micro(),
-    erlang:apply(Fun, Args),
-    Stop = folsom_utils:now_epoch_micro(),
-    notify({Name, Stop - Start}).
+    {Time, Value} = timer:tc(Fun, Args),
+    ok = notify({Name, Time}),
+    Value.
 
 histogram_timed_update(Name, Mod, Fun, Args) ->
-    Start = folsom_utils:now_epoch_micro(),
-    erlang:apply(Mod, Fun, Args),
-    Stop = folsom_utils:now_epoch_micro(),
-    notify({Name, Stop - Start}).
+    {Time, Value} = timer:tc(Mod, Fun, Args),
+    ok = notify({Name, Time}),
+    Value.
diff --git a/test/folsom_erlang_checks.erl b/test/folsom_erlang_checks.erl
index 8a2b821..4b649b0 100644
--- a/test/folsom_erlang_checks.erl
+++ b/test/folsom_erlang_checks.erl
@@ -51,6 +51,8 @@
 
     ok = folsom_metrics:new_histogram(nonea, none, 5000, 1),
 
+    ok = folsom_metrics:new_histogram(timed, none, 5000, 1),
+
     ok = folsom_metrics:new_history(<<"history">>),
     ok = folsom_metrics:new_meter(meter),
 
@@ -66,7 +68,7 @@
     {state, List} = folsom_meter_timer_server:dump(),
     1 = length(List),
 
-    8 = length(folsom_metrics:get_metrics()),
+    9 = length(folsom_metrics:get_metrics()),
 
     ?debugFmt("~n~nmetrics: ~p~n", [folsom_metrics:get_metrics()]).
 
@@ -82,6 +84,8 @@
 
     [ok = folsom_metrics:notify({nonea, Value}) || Value <- ?DATA1],
 
+    3.141592653589793 = folsom_metrics:histogram_timed_update(timed, math, pi, []),
+
     ok = folsom_metrics:notify({<<"history">>, "string"}),
 
     {error, _, nonexistant_metric} = folsom_metrics:notify({historya, "5"}),
@@ -110,6 +114,9 @@
     CoValues = folsom_metrics:get_histogram_statistics(none, nonea),
     histogram_co_checks(CoValues),
 
+    List = folsom_metrics:get_metric_value(timed),
+    ?debugFmt("timed update value: ~p", [List]),
+
     1 = length(folsom_metrics:get_metric_value(<<"history">>)),
     1 = length(folsom_metrics:get_metric_value(historya)),
 
@@ -124,7 +131,7 @@
     end.
 
 delete_metrics() ->
-    10 = length(ets:tab2list(?FOLSOM_TABLE)),
+    11 = length(ets:tab2list(?FOLSOM_TABLE)),
 
     ok = folsom_metrics:delete_metric(counter),
     ok = folsom_metrics:delete_metric(<<"gauge">>),
@@ -137,6 +144,7 @@
     ok = folsom_metrics:delete_metric(historya),
 
     ok = folsom_metrics:delete_metric(nonea),
+    ok = folsom_metrics:delete_metric(timed),
     ok = folsom_metrics:delete_metric(testcounter),
 
     1 = length(ets:tab2list(?METER_TABLE)),
@@ -153,7 +161,12 @@
     true = lists:keymember(context_switches, 1, List2),
 
     List3 = folsom_vm_metrics:get_system_info(),
-    true = lists:keymember(allocated_areas, 1, List3).
+    true = lists:keymember(allocated_areas, 1, List3),
+
+    [{_, [{backtrace, _}| _]} | _] = folsom_vm_metrics:get_process_info(),
+
+    [{_, [{name, _}| _]} | _] = folsom_vm_metrics:get_port_info().
+
 
 counter_metric(Count, Counter) ->
     ok = folsom_metrics:new_counter(Counter),