~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/mnesia/test/mnesia_measure_test.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
 
5
%% 
 
6
%% The contents of this file are subject to the Erlang Public License,
 
7
%% Version 1.1, (the "License"); you may not use this file except in
 
8
%% compliance with the License. You should have received a copy of the
 
9
%% Erlang Public License along with this software. If not, it can be
 
10
%% retrieved online at http://www.erlang.org/.
 
11
%% 
 
12
%% Software distributed under the License is distributed on an "AS IS"
 
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
14
%% the License for the specific language governing rights and limitations
 
15
%% under the License.
 
16
%% 
 
17
%% %CopyrightEnd%
 
18
%%
 
19
 
 
20
%%
 
21
-module(mnesia_measure_test).
 
22
-author('hakan@erix.ericsson.se').
 
23
-compile([export_all]).
 
24
 
 
25
-include("mnesia_test_lib.hrl").
 
26
 
 
27
init_per_testcase(Func, Conf) ->
 
28
    mnesia_test_lib:init_per_testcase(Func, Conf).
 
29
 
 
30
end_per_testcase(Func, Conf) ->
 
31
    mnesia_test_lib:end_per_testcase(Func, Conf).
 
32
 
 
33
-define(init(N, Config),
 
34
        mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]},
 
35
                                           delete_schema],
 
36
                                          N, Config, ?FILE, ?LINE)).
 
37
 
 
38
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
39
 
 
40
all() -> 
 
41
    [{group, prediction}, {group, consumption},
 
42
     {group, scalability}, {group, benchmarks}].
 
43
 
 
44
groups() -> 
 
45
    [{prediction, [],
 
46
      [reader_disturbed_by_node_down,
 
47
       writer_disturbed_by_node_down,
 
48
       reader_disturbed_by_node_up,
 
49
       writer_disturbed_by_node_up,
 
50
       reader_disturbed_by_schema_ops,
 
51
       writer_disturbed_by_schema_ops,
 
52
       reader_disturbed_by_checkpoint,
 
53
       writer_disturbed_by_checkpoint,
 
54
       reader_disturbed_by_dump_log,
 
55
       writer_disturbed_by_dump_log,
 
56
       reader_disturbed_by_backup, writer_disturbed_by_backup,
 
57
       reader_disturbed_by_restore,
 
58
       writer_disturbed_by_restore, {group, fairness}]},
 
59
     {fairness, [],
 
60
      [reader_competing_with_reader,
 
61
       reader_competing_with_writer,
 
62
       writer_competing_with_reader,
 
63
       writer_competing_with_writer]},
 
64
     {consumption, [],
 
65
      [measure_resource_consumption,
 
66
       determine_resource_leakage]},
 
67
     {scalability, [],
 
68
      [determine_system_limits, performance_at_min_config,
 
69
       performance_at_max_config, performance_at_full_load,
 
70
       resource_consumption_at_min_config,
 
71
       resource_consumption_at_max_config,
 
72
       resource_consumption_at_full_load]},
 
73
     {benchmarks, [],
 
74
      [{group, meter}, cost, dbn_meters,
 
75
       measure_all_api_functions, {group, tpcb},
 
76
       mnemosyne_vs_mnesia_kernel]},
 
77
     {tpcb, [], [ram_tpcb, disc_tpcb, disc_only_tpcb]},
 
78
     {meter, [], [ram_meter, disc_meter, disc_only_meter]}].
 
79
 
 
80
init_per_group(_GroupName, Config) ->
 
81
    Config.
 
82
 
 
83
end_per_group(_GroupName, Config) ->
 
84
    Config.
 
85
 
 
86
     
 
87
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
88
 
 
89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
90
 
 
91
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
92
 
 
93
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
94
 
 
95
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
96
 
 
97
dbn_meters(suite) -> [];
 
98
dbn_meters(Config) when is_list(Config) ->
 
99
    _Nodes = ?init(3, Config),
 
100
    ?match(ok, mnesia_dbn_meters:start()),
 
101
    ok.
 
102
 
 
103
 
 
104
tpcb(ReplicaType, Config) ->
 
105
    HarakiriDelay = {tc_timeout, timer:minutes(20)},
 
106
    Nodes = ?acquire_nodes(2, Config ++ [HarakiriDelay]),
 
107
    Args = [{n_branches, 2},
 
108
            {n_drivers_per_node, 1},
 
109
            {replica_nodes, Nodes},
 
110
            {driver_nodes, [hd(Nodes)]},
 
111
            {use_running_mnesia, true},
 
112
            {use_sticky_locks, true},
 
113
            {replica_type, ReplicaType}],
 
114
    ?match({ok, _}, mnesia_tpcb:start(Args)),
 
115
    ?verify_mnesia(Nodes, []).
 
116
 
 
117
ram_tpcb(suite) -> [];
 
118
ram_tpcb(Config) when is_list(Config) ->
 
119
    tpcb(ram_copies, Config).
 
120
 
 
121
disc_tpcb(suite) -> [];
 
122
disc_tpcb(Config) when is_list(Config) ->
 
123
    tpcb(disc_copies, Config).
 
124
 
 
125
disc_only_tpcb(suite) -> [];
 
126
disc_only_tpcb(Config) when is_list(Config) ->
 
127
    tpcb(disc_only_copies, Config).
 
128
 
 
129
 
 
130
ram_meter(suite) -> [];
 
131
ram_meter(Config) when is_list(Config) ->
 
132
    HarakiriDelay = [{tc_timeout, timer:minutes(20)}],
 
133
    Nodes = ?init(3, Config ++ HarakiriDelay),
 
134
    ?match(ok, mnesia_meter:go(ram_copies, Nodes)).
 
135
 
 
136
disc_meter(suite) -> [];
 
137
disc_meter(Config) when is_list(Config) ->
 
138
    HarakiriDelay = [{tc_timeout, timer:minutes(20)}],
 
139
    Nodes = ?init(3, Config ++ HarakiriDelay),
 
140
    ?match(ok, mnesia_meter:go(disc_copies, Nodes)).
 
141
 
 
142
disc_only_meter(suite) -> [];
 
143
disc_only_meter(Config) when is_list(Config) ->
 
144
    HarakiriDelay = [{tc_timeout, timer:minutes(20)}],
 
145
    Nodes = ?init(3, Config ++ HarakiriDelay),
 
146
    ?match(ok, mnesia_meter:go(disc_only_copies, Nodes)).
 
147
 
 
148
cost(suite) -> [];
 
149
cost(Config) when is_list(Config) ->
 
150
    Nodes = ?init(3, Config),
 
151
    ?match(ok, mnesia_cost:go(Nodes)),
 
152
    file:delete("MNESIA_COST").