Permalink
Browse files

Use granderl

  • Loading branch information...
lpgauth committed Jun 14, 2016
1 parent ce5bdb6 commit 4fa928a529b6490dc2a4795e7ff3d0d34eb909b4
View
@@ -1,13 +1,21 @@
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5
cache:
directories:
- $HOME/.cache/rebar3
- $TRAVIS_BUILD_DIR/_build
env:
- CC=gcc-5
install: true
language: erlang
notifications:
email: false
otp_release:
- 18.0
- 18.3
- 17.5
script: "make travis"
sudo: false
View
@@ -37,8 +37,9 @@ profile:
@$(REBAR3) as test compile
@erl -noshell \
-pa _build/test/lib/*/ebin \
-eval 'statsderl_profile:fprofx()' \
-eval 'init:stop()'
-pa _build/test/lib/*/test \
-eval 'statsderl_profile:fprofx()' \
-eval 'init:stop()'
@_build/test/lib/fprofx/erlgrindx -p fprofx.analysis
@$(CACHEGRIND) fprofx.cgrind
View
Binary file not shown.
View
@@ -9,7 +9,7 @@
-define(ENV_HOSTNAME, hostname).
-define(ENV_PORT, port).
-define(ENV_VARS, [?ENV_BASEKEY, ?ENV_HOSTNAME, ?ENV_PORT]).
-define(MAX_UNSIGNED_INT_32, 4294967296).
-define(MAX_UNSIGNED_INT_32, 4294967295).
-define(POOL_SIZE, 4).
-define(SERVER, statsderl_server).
View
@@ -7,6 +7,11 @@
{coveralls_coverdata, "_build/test/cover/eunit.coverdata"}.
{coveralls_service_name, "travis-ci"}.
{deps, [
{granderl, ".*",
{git, "https://github.com/tokenrove/granderl.git", {tag, "v0.1.1"}}}
]}.
{edoc_opts, [
{app_default, "http://www.erlang.org/doc/man"},
{doclet, edown_doclet},
View
@@ -1 +1,4 @@
[].
[{<<"granderl">>,
{git,"https://github.com/tokenrove/granderl.git",
{ref,"b44725cdd3ae6d2d4170e0d72ebb2fcad98d5ad2"}},
0}].
View
@@ -4,7 +4,8 @@
{registered, []},
{applications, [
kernel,
stdlib
stdlib,
granderl
]},
{mod, {statsderl_app, []}},
{env, []}
View
@@ -13,10 +13,10 @@
]).
%% public
-spec start() -> ok | {error, atom()}.
-spec start() -> {ok, [atom()]} | {error, term()}.
start() ->
application:start(?APP).
application:ensure_all_started(?APP).
-spec stop() -> ok | {error, {not_started, ?APP}}.
View
@@ -59,7 +59,7 @@ getaddrs(Hostname) ->
-spec random(pos_integer()) -> pos_integer().
random(N) ->
erlang:phash2({self(), timestamp()}, N) + 1.
granderl:uniform(N).
-spec random_element([term()]) -> term().
View
@@ -11,16 +11,11 @@
-spec fprofx() -> ok.
fprofx() ->
Filenames = filelib:wildcard("_build/default/lib/*/ebin/*.beam"),
Rootnames = [filename:rootname(Filename, ".beam") || Filename <- Filenames],
lists:foreach(fun code:load_abs/1, Rootnames),
application:start(statsderl),
increment(),
preload_modules(),
fprofx:start(),
{ok, Tracer} = fprofx:profile(start),
fprofx:trace([start, {procs, new}, {tracer, Tracer}]),
application:start(statsderl),
Self = self(),
[spawn(fun () ->
@@ -32,7 +27,6 @@ fprofx() ->
fprofx:trace(stop),
fprofx:analyse([totals, {dest, ""}]),
fprofx:stop(),
application:stop(statsderl),
ok.
@@ -42,6 +36,11 @@ increment() ->
[statsderl:increment(["test", <<".test">>], 1, 0.25) ||
_ <- lists:seq(1, ?N)].
preload_modules() ->
Filenames = filelib:wildcard("_build/default/lib/*/ebin/*.beam"),
Rootnames = [filename:rootname(Filename, ".beam") || Filename <- Filenames],
lists:foreach(fun code:load_abs/1, Rootnames).
wait() ->
wait(?P).
View
@@ -64,7 +64,7 @@ increment_subtest(Socket) ->
sampling_rate_subtest(Socket) ->
meck:new(statsderl_utils, [passthrough, no_history]),
meck:expect(statsderl_utils, random, fun (?MAX_UNSIGNED_INT_32) -> 0 end),
meck:expect(statsderl_utils, random, fun (?MAX_UNSIGNED_INT_32) -> 1 end),
statsderl:counter("test", 1, 0.1234),
assert_packet(Socket, <<"test:1|c|@0.123">>),
meck:expect(statsderl_utils, random, fun (?MAX_UNSIGNED_INT_32) ->

0 comments on commit 4fa928a

Please sign in to comment.