1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions 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()).
|