aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/examples/bench/bench.hrl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/mnesia/examples/bench/bench.hrl
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/mnesia/examples/bench/bench.hrl')
-rw-r--r--lib/mnesia/examples/bench/bench.hrl107
1 files changed, 107 insertions, 0 deletions
diff --git a/lib/mnesia/examples/bench/bench.hrl b/lib/mnesia/examples/bench/bench.hrl
new file mode 100644
index 0000000000..7b0e0c1280
--- /dev/null
+++ b/lib/mnesia/examples/bench/bench.hrl
@@ -0,0 +1,107 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% File : bench.hrl
+%%% Author : Hakan Mattsson <[email protected]>
+%%% Purpose : Define various database records
+%%% Created : 21 Jun 2001 by Hakan Mattsson <[email protected]>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+-record(config,
+ {
+ generator_profile = random,
+ generator_warmup = timer:seconds(2),
+ generator_duration = timer:seconds(15),
+ generator_cooldown = timer:seconds(2),
+ generator_nodes = [node() | nodes()],
+ statistics_detail = debug,
+ n_generators_per_node = 1,
+ write_lock_type = sticky_write,
+ table_nodes = [node() | nodes()],
+ storage_type = ram_copies,
+ n_subscribers = 25000,
+ n_groups = 5,
+ n_servers = 1,
+ n_replicas = 1,
+ n_fragments = 100,
+ use_binary_subscriber_key = false,
+ always_try_nearest_node = false,
+ cookie = 'bench'
+ }).
+
+-record(subscriber,
+ {
+ subscriber_number, % string (10 chars)
+ subscriber_name, % string (32 chars)
+ group_id, % integer (uint32)
+ location, % integer (uint32)
+ active_sessions, % array of 32 booleans (32 bits)
+ changed_by, % string (25 chars)
+ changed_time, % string (25 chars)
+ suffix
+ }).
+
+-record(group,
+ {
+ group_id, % integer (uint32)
+ group_name, % string (32 chars)
+ allow_read, % array of 32 booleans (32 bits)
+ allow_insert, % array of 32 booleans (32 bits)
+ allow_delete % array of 32 booleans (32 bits)
+ }).
+
+-record(server,
+ {
+ server_key, % {ServerId, SubscriberNumberSuffix}
+ server_name, % string (32 chars)
+ no_of_read, % integer (uint32)
+ no_of_insert, % integer (uint32)
+ no_of_delete, % integer (uint32)
+ suffix
+ }).
+
+-record(session,
+ {
+ session_key, % {SubscriberNumber, ServerId}
+ session_details, % string (4000 chars)
+ suffix
+ }).
+
+-define(d(Format, Args),
+ io:format("~s" ++ Format, [string:left(lists:flatten(io_lib:format("~p(~p):", [?MODULE, ?LINE])), 30, $ ) | Args])).
+
+-define(e(Format, Args),
+ begin
+ ok = error_logger:format("~p(~p): " ++ Format, [?MODULE, ?LINE | Args]),
+ timer:sleep(1000)
+ end).
+
+-define(ERROR(M, F, A, R),
+ ?e("~w:~w~p\n\t ->~p\n", [M, F, A, R])).
+
+-define(APPLY(M, F, A),
+ fun() ->
+ case catch apply(M, F, A) of
+ ok -> {ok, ok};
+ {atomic, R} -> {ok, R};
+ {ok, R} -> {ok, R};
+ {aborted, R} -> ?ERROR(M, F, A, R);
+ {error, R} -> ?ERROR(M, F, A, R);
+ R -> ?ERROR(M, F, A, R)
+ end
+ end()).