Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test/couch_lier_counter: measure running time

  • Loading branch information...
commit 1aa271ecb9b7709009b89e6297acf8b22f51e8f6 1 parent 40d31fd
@astro authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 test/couch_lier_counter.erl
View
11 test/couch_lier_counter.erl
@@ -9,6 +9,7 @@ run() ->
run(counter, "localhost", 5984).
run(Db, Host, Port) ->
+ Time1 = current_timestamp(),
mnesia:start(),
couch_lier:create_database(Db, Host, Port),
@@ -37,7 +38,9 @@ run(Db, Host, Port) ->
Counter = get_counter_t(Db),
couch_lier:delete(Db, "counter"),
Counter
- end).
+ end),
+ Time2 = current_timestamp(),
+ {Time2 - Time1, us}.
wait_for_workers([]) ->
@@ -82,3 +85,9 @@ get_counter_t(Db) ->
set_counter_t(Db, Counter) ->
couch_lier:write(Db, "counter", {struct, [{<<"value">>, Counter}]}).
+
+
+current_timestamp() ->
+ {MS, S, SS} = now(),
+ (MS * 1000000 + S) * 1000000 + SS.
+

0 comments on commit 1aa271e

Please sign in to comment.
Something went wrong with that request. Please try again.