higgs 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +67 -0
- data/bin/higgs_apply_jlog +1 -1
- data/bin/higgs_backup +1 -1
- data/bin/higgs_dump_index +1 -1
- data/bin/higgs_dump_jlog +1 -1
- data/bin/higgs_ping +1 -1
- data/bin/higgs_verify +1 -1
- data/lib/cgi/session/higgs.rb +3 -3
- data/lib/higgs/block.rb +3 -3
- data/lib/higgs/cache.rb +17 -13
- data/lib/higgs/dbm.rb +3 -3
- data/lib/higgs/exceptions.rb +3 -3
- data/lib/higgs/flock.rb +3 -3
- data/lib/higgs/index.rb +35 -17
- data/lib/higgs/jlog.rb +3 -3
- data/lib/higgs/lock.rb +5 -5
- data/lib/higgs/services.rb +3 -3
- data/lib/higgs/sman.rb +7 -3
- data/lib/higgs/storage.rb +14 -3
- data/lib/higgs/store.rb +3 -3
- data/lib/higgs/tar.rb +3 -3
- data/lib/higgs/thread.rb +130 -8
- data/lib/higgs/tman.rb +15 -13
- data/lib/higgs/utils/bman.rb +3 -3
- data/lib/higgs/utils.rb +3 -3
- data/lib/higgs/version.rb +4 -4
- data/lib/higgs.rb +2 -2
- data/misc/cache_bench/cache_bench.rb +2 -2
- data/misc/dbm_bench/.strc +1 -1
- data/misc/dbm_bench/Rakefile +1 -1
- data/misc/dbm_bench/dbm_multi_thread.rb +2 -2
- data/misc/dbm_bench/dbm_rnd_delete.rb +2 -2
- data/misc/dbm_bench/dbm_rnd_read.rb +2 -2
- data/misc/dbm_bench/dbm_rnd_update.rb +2 -2
- data/misc/dbm_bench/dbm_seq_read.rb +2 -2
- data/misc/dbm_bench/dbm_seq_write.rb +2 -2
- data/misc/dbm_bench/run.rb +52 -0
- data/misc/dbm_bench/st_verify.rb +2 -2
- data/misc/io_bench/cksum_bench.rb +1 -1
- data/misc/io_bench/jlog_bench.rb +2 -2
- data/misc/io_bench/write_bench.rb +1 -1
- data/misc/thread_bench/lock_bench.rb +2 -2
- data/test/Rakefile +1 -1
- data/test/run.rb +3 -3
- data/test/test_block.rb +1 -1
- data/test/test_cache.rb +9 -9
- data/test/test_cache_mvcc.rb +403 -168
- data/test/test_cgi_session.rb +3 -3
- data/test/test_dbm.rb +14 -5
- data/test/test_flock.rb +1 -1
- data/test/test_index.rb +5 -7
- data/test/test_jlog.rb +1 -1
- data/test/test_lock.rb +21 -21
- data/test/test_online_backup.rb +1 -1
- data/test/test_services.rb +1 -1
- data/test/test_storage.rb +4 -4
- data/test/test_storage_conf.rb +1 -1
- data/test/test_storage_init_opts.rb +1 -1
- data/test/test_store.rb +2 -2
- data/test/test_tar.rb +19 -19
- data/test/test_thread.rb +46 -46
- data/test/test_tman.rb +2 -2
- data/test/test_tman_init_opts.rb +1 -1
- data/test/test_tman_mvcc.rb +11 -11
- data/test/test_utils_bman.rb +4 -2
- metadata +10 -18
- data/Rakefile +0 -81
- data/mkrdoc.rb +0 -11
- data/rdoc.yml +0 -13
data/lib/higgs/store.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = storage like pstore
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date:
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -218,7 +218,7 @@ module Higgs
|
|
218
218
|
#
|
219
219
|
class Store < StorageManager
|
220
220
|
# for ident(1)
|
221
|
-
CVS_ID = '$Id: store.rb
|
221
|
+
CVS_ID = '$Id: store.rb 781 2008-07-28 15:13:27Z toki $'
|
222
222
|
|
223
223
|
DECODE = proc{|r| Marshal.load(r) }
|
224
224
|
ENCODE = proc{|w| Marshal.dump(w) }
|
data/lib/higgs/tar.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = unix TAR utilities
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date:
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -14,7 +14,7 @@ require 'higgs/exceptions'
|
|
14
14
|
module Higgs
|
15
15
|
module Tar
|
16
16
|
# for ident(1)
|
17
|
-
CVS_ID = '$Id: tar.rb
|
17
|
+
CVS_ID = '$Id: tar.rb 781 2008-07-28 15:13:27Z toki $'
|
18
18
|
|
19
19
|
include Exceptions
|
20
20
|
|
data/lib/higgs/thread.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = multi-thread utilities
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date: 2008-
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -12,10 +12,132 @@ require 'forwardable'
|
|
12
12
|
require 'higgs/exceptions'
|
13
13
|
require 'thread'
|
14
14
|
|
15
|
+
class Module
|
16
|
+
# alias for Higgs::Synchronized
|
17
|
+
alias __higgs_ruby_native_attr__ attr
|
18
|
+
|
19
|
+
# alias for Higgs::Synchronized
|
20
|
+
alias __higgs_ruby_native_attr_accessor__ attr_accessor
|
21
|
+
|
22
|
+
# alias for Higgs::Synchronized
|
23
|
+
alias __higgs_ruby_native_attr_reader__ attr_reader
|
24
|
+
|
25
|
+
# alias for Higgs::Synchronized
|
26
|
+
alias __higgs_ruby_native_attr_writer__ attr_writer
|
27
|
+
|
28
|
+
# re-define for Higgs::Synchronized
|
29
|
+
def attr(name, assignable=false)
|
30
|
+
__higgs_ruby_native_attr__(name, assignable)
|
31
|
+
if (assignable) then
|
32
|
+
[ name, "#{name}=" ]
|
33
|
+
else
|
34
|
+
name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# re-define for Higgs::Synchronized
|
39
|
+
def attr_accessor(name, *optional_names)
|
40
|
+
names = [ name ] + optional_names
|
41
|
+
__higgs_ruby_native_attr_accessor__(*names)
|
42
|
+
return *names.map{|n| [ n, "#{n}=" ] }.flatten
|
43
|
+
end
|
44
|
+
|
45
|
+
# re-define for Higgs::Synchronized
|
46
|
+
def attr_reader(name, *optional_names)
|
47
|
+
names = [ name ] + optional_names
|
48
|
+
__higgs_ruby_native_attr_reader__(*names)
|
49
|
+
return *names
|
50
|
+
end
|
51
|
+
|
52
|
+
# re-define for Higgs::Synchronized
|
53
|
+
def attr_writer(name, *optional_names)
|
54
|
+
names = [ name ] + optional_names
|
55
|
+
__higgs_ruby_native_attr_writer__(*names)
|
56
|
+
return *names.map{|n| "#{n}=" }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module Forwardable
|
61
|
+
# alias for Higgs::Synchronized
|
62
|
+
alias __higgs_ruby_native_def_instance_delegators__ def_instance_delegators
|
63
|
+
|
64
|
+
# alias for Higgs::Synchronized
|
65
|
+
alias __higgs_ruby_native_def_instance_delegator__ def_instance_delegator
|
66
|
+
|
67
|
+
# re-define for Higgs::Synchronized
|
68
|
+
def def_instance_delegators(accessor, *methods)
|
69
|
+
__higgs_ruby_native_def_instance_delegators__(accessor, *methods)
|
70
|
+
return *methods
|
71
|
+
end
|
72
|
+
|
73
|
+
# re-define for Higgs::Synchronized
|
74
|
+
def def_instance_delegator(accessor, method, ali = method)
|
75
|
+
__higgs_ruby_native_def_instance_delegator__(accessor, method, ali)
|
76
|
+
ali
|
77
|
+
end
|
78
|
+
|
79
|
+
# re-define for Higgs::Synchronized
|
80
|
+
alias def_delegators def_instance_delegators
|
81
|
+
|
82
|
+
# re-define for Higgs::Synchronized
|
83
|
+
alias def_delegator def_instance_delegator
|
84
|
+
end
|
85
|
+
|
15
86
|
module Higgs
|
87
|
+
module Synchronized
|
88
|
+
def self.included(mod)
|
89
|
+
r = super
|
90
|
+
mod.extend(SynchronizedSyntax)
|
91
|
+
r
|
92
|
+
end
|
93
|
+
|
94
|
+
attr_accessor :__lock__
|
95
|
+
end
|
96
|
+
|
97
|
+
module SynchronizedSyntax
|
98
|
+
def synchronized(name_or_names, *optional_names)
|
99
|
+
case (name_or_names)
|
100
|
+
when Array
|
101
|
+
names = name_or_names
|
102
|
+
else
|
103
|
+
names = [ name_or_names ]
|
104
|
+
end
|
105
|
+
names += optional_names
|
106
|
+
|
107
|
+
for name in names
|
108
|
+
name = name.to_sym
|
109
|
+
thread_unsafe_name = "thread_unsafe_#{name}".to_sym
|
110
|
+
|
111
|
+
if (public_instance_methods(true).any?{|n| n.to_sym == name }) then
|
112
|
+
visibility = 'public'
|
113
|
+
elsif (private_instance_methods(true).any?{|n| n.to_sym == name }) then
|
114
|
+
visibility = 'private'
|
115
|
+
elsif (protected_instance_methods(true).any?{|n| n.to_sym == name }) then
|
116
|
+
visibility = 'protected'
|
117
|
+
else
|
118
|
+
raise NoMethodError, "undefined method `#{name}' for #{self}"
|
119
|
+
end
|
120
|
+
|
121
|
+
class_eval(<<-EOF, "synchronized(#{name}) => #{__FILE__}", __LINE__ + 1)
|
122
|
+
alias_method #{thread_unsafe_name.inspect}, #{name.inspect}
|
123
|
+
private #{thread_unsafe_name.inspect}
|
124
|
+
|
125
|
+
def #{name}(*args, &block)
|
126
|
+
@__lock__.synchronize{
|
127
|
+
__send__(#{thread_unsafe_name.inspect}, *args, &block)
|
128
|
+
}
|
129
|
+
end
|
130
|
+
#{visibility} #{name.inspect}
|
131
|
+
EOF
|
132
|
+
end
|
133
|
+
|
134
|
+
name_or_names
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
16
138
|
class Latch
|
17
139
|
# for ident(1)
|
18
|
-
CVS_ID = '$Id: thread.rb
|
140
|
+
CVS_ID = '$Id: thread.rb 781 2008-07-28 15:13:27Z toki $'
|
19
141
|
|
20
142
|
def initialize
|
21
143
|
@lock = Mutex.new
|
@@ -43,7 +165,7 @@ module Higgs
|
|
43
165
|
|
44
166
|
class CountDownLatch
|
45
167
|
# for ident(1)
|
46
|
-
CVS_ID = '$Id: thread.rb
|
168
|
+
CVS_ID = '$Id: thread.rb 781 2008-07-28 15:13:27Z toki $'
|
47
169
|
|
48
170
|
def initialize(count)
|
49
171
|
@count = count
|
@@ -73,7 +195,7 @@ module Higgs
|
|
73
195
|
|
74
196
|
class Barrier
|
75
197
|
# for ident(1)
|
76
|
-
CVS_ID = '$Id: thread.rb
|
198
|
+
CVS_ID = '$Id: thread.rb 781 2008-07-28 15:13:27Z toki $'
|
77
199
|
|
78
200
|
def initialize(count)
|
79
201
|
@count = count
|
@@ -102,7 +224,7 @@ module Higgs
|
|
102
224
|
|
103
225
|
class SharedWork
|
104
226
|
# for ident(1)
|
105
|
-
CVS_ID = '$Id: thread.rb
|
227
|
+
CVS_ID = '$Id: thread.rb 781 2008-07-28 15:13:27Z toki $'
|
106
228
|
|
107
229
|
def initialize(&work)
|
108
230
|
unless (work) then
|
@@ -191,7 +313,7 @@ module Higgs
|
|
191
313
|
|
192
314
|
class ReadWriteLock
|
193
315
|
# for ident(1)
|
194
|
-
CVS_ID = '$Id: thread.rb
|
316
|
+
CVS_ID = '$Id: thread.rb 781 2008-07-28 15:13:27Z toki $'
|
195
317
|
|
196
318
|
def initialize
|
197
319
|
@lock = Mutex.new
|
@@ -325,7 +447,7 @@ module Higgs
|
|
325
447
|
|
326
448
|
class Pool
|
327
449
|
# for ident(1)
|
328
|
-
CVS_ID = '$Id: thread.rb
|
450
|
+
CVS_ID = '$Id: thread.rb 781 2008-07-28 15:13:27Z toki $'
|
329
451
|
|
330
452
|
class ShutdownException < Exceptions::ShutdownException
|
331
453
|
end
|
data/lib/higgs/tman.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = transaction manager
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date: 2008-
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -17,7 +17,7 @@ require 'singleton'
|
|
17
17
|
module Higgs
|
18
18
|
class TransactionManager
|
19
19
|
# for ident(1)
|
20
|
-
CVS_ID = '$Id: tman.rb
|
20
|
+
CVS_ID = '$Id: tman.rb 781 2008-07-28 15:13:27Z toki $'
|
21
21
|
|
22
22
|
include Exceptions
|
23
23
|
|
@@ -92,6 +92,7 @@ module Higgs
|
|
92
92
|
if (@read_only == :standby && ! @jlog_apply_dir) then
|
93
93
|
raise ArgumentError, "need for `:jlog_apply_dir' parameter in standby mode"
|
94
94
|
end
|
95
|
+
@cnum_func = @storage.method(:change_number)
|
95
96
|
@mvcc_cache = MVCCCache.new
|
96
97
|
@master_cache = SharedWorkCache.new(@master_cache) {|key|
|
97
98
|
(id = @storage.unique_data_id(key) and @secondary_cache[id]) or
|
@@ -104,7 +105,7 @@ module Higgs
|
|
104
105
|
def transaction(read_only=@read_only)
|
105
106
|
r = nil
|
106
107
|
@lock_manager.transaction(read_only) {|lock_handler|
|
107
|
-
@mvcc_cache.transaction(@
|
108
|
+
@mvcc_cache.transaction(@cnum_func) {|snapshot|
|
108
109
|
if (read_only) then
|
109
110
|
tx = ReadOnlyTransactionContext.new(lock_handler, @storage, snapshot, @master_cache, @secondary_cache, @decode, @encode)
|
110
111
|
else
|
@@ -113,9 +114,8 @@ module Higgs
|
|
113
114
|
end
|
114
115
|
tx = ReadWriteTransactionContext.new(lock_handler, @storage, snapshot, @master_cache, @secondary_cache, @decode, @encode)
|
115
116
|
end
|
116
|
-
Thread.current[:higgs_current_transaction] = tx
|
117
117
|
r = yield(tx)
|
118
|
-
tx.commit unless read_only
|
118
|
+
tx.commit(false) unless read_only
|
119
119
|
}
|
120
120
|
}
|
121
121
|
r
|
@@ -151,7 +151,7 @@ module Higgs
|
|
151
151
|
|
152
152
|
class TransactionContext
|
153
153
|
# for ident(1)
|
154
|
-
CVS_ID = '$Id: tman.rb
|
154
|
+
CVS_ID = '$Id: tman.rb 781 2008-07-28 15:13:27Z toki $'
|
155
155
|
|
156
156
|
include Enumerable
|
157
157
|
|
@@ -506,7 +506,7 @@ module Higgs
|
|
506
506
|
end
|
507
507
|
private :write_list
|
508
508
|
|
509
|
-
def commit
|
509
|
+
def commit(continue=true)
|
510
510
|
write_list = write_list()
|
511
511
|
if (write_list.empty?) then
|
512
512
|
return
|
@@ -529,7 +529,7 @@ module Higgs
|
|
529
529
|
case (ope)
|
530
530
|
when :write
|
531
531
|
if (@storage.key? key) then
|
532
|
-
properties =
|
532
|
+
properties = deep_copy(@storage.fetch_properties(key))
|
533
533
|
old_write_list << [ :value, key, :data, @master_cache[key] ]
|
534
534
|
old_write_list << [ :value, key, :properties, properties ]
|
535
535
|
old_write_list << [ :value, key, :identity, @storage.identity(key) ]
|
@@ -541,7 +541,7 @@ module Higgs
|
|
541
541
|
end
|
542
542
|
when :system_properties, :custom_properties
|
543
543
|
if (@storage.key? key) then
|
544
|
-
properties =
|
544
|
+
properties = deep_copy(@storage.fetch_properties(key))
|
545
545
|
old_write_list << [ :value, key, :properties, properties ]
|
546
546
|
old_write_list << [ :value, key, :properties_change_number, @storage.properties_change_number(key) ]
|
547
547
|
else
|
@@ -549,7 +549,7 @@ module Higgs
|
|
549
549
|
end
|
550
550
|
when :delete
|
551
551
|
if (@storage.key? key) then
|
552
|
-
properties =
|
552
|
+
properties = deep_copy(@storage.fetch_properties(key))
|
553
553
|
old_write_list << [ :value, key, :data, @master_cache[key] ]
|
554
554
|
old_write_list << [ :value, key, :properties, properties ]
|
555
555
|
old_write_list << [ :value, key, :identity, @storage.identity(key) ]
|
@@ -575,8 +575,10 @@ module Higgs
|
|
575
575
|
@ope_map.clear
|
576
576
|
|
577
577
|
@storage.write_and_commit(write_list)
|
578
|
-
|
579
|
-
|
578
|
+
if (continue) then
|
579
|
+
@snapshot.ref_count_down
|
580
|
+
@snapshot.ref_count_up(@storage.method(:change_number))
|
581
|
+
end
|
580
582
|
}
|
581
583
|
|
582
584
|
nil
|
data/lib/higgs/utils/bman.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = backup manager
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date:
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -164,7 +164,7 @@ module Higgs
|
|
164
164
|
#
|
165
165
|
class BackupManager
|
166
166
|
# for ident(1)
|
167
|
-
CVS_ID = '$Id: bman.rb
|
167
|
+
CVS_ID = '$Id: bman.rb 781 2008-07-28 15:13:27Z toki $'
|
168
168
|
|
169
169
|
def initialize(options={})
|
170
170
|
@from = options[:from]
|
data/lib/higgs/utils.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = namespace for utilities
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date:
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -12,7 +12,7 @@ module Higgs
|
|
12
12
|
# = namespace for command-line utilities
|
13
13
|
module Utils
|
14
14
|
# for ident(1)
|
15
|
-
CVS_ID = '$Id: utils.rb
|
15
|
+
CVS_ID = '$Id: utils.rb 781 2008-07-28 15:13:27Z toki $'
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/lib/higgs/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = version
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date: 2008-
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
module Higgs
|
12
12
|
# for ident(1)
|
13
|
-
CVS_ID = '$Id: version.rb
|
13
|
+
CVS_ID = '$Id: version.rb 781 2008-07-28 15:13:27Z toki $'
|
14
14
|
|
15
|
-
VERSION = '0.1.
|
15
|
+
VERSION = '0.1.6'
|
16
16
|
end
|
17
17
|
|
18
18
|
# Local Variables:
|
data/lib/higgs.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# = pure ruby transactional storage compatible with unix TAR format
|
2
2
|
#
|
3
3
|
# Author:: $Author: toki $
|
4
|
-
# Date:: $Date:
|
5
|
-
# Revision:: $Revision:
|
4
|
+
# Date:: $Date: 2008-07-29 00:13:27 +0900 (Tue, 29 Jul 2008) $
|
5
|
+
# Revision:: $Revision: 781 $
|
6
6
|
#
|
7
7
|
# == license
|
8
8
|
# :include:LICENSE
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: cache_bench.rb
|
4
|
+
CVS_ID = '$Id: cache_bench.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/cache'
|
data/misc/dbm_bench/.strc
CHANGED
data/misc/dbm_bench/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: dbm_multi_thread.rb
|
4
|
+
CVS_ID = '$Id: dbm_multi_thread.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/dbm'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: dbm_rnd_delete.rb
|
4
|
+
CVS_ID = '$Id: dbm_rnd_delete.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/dbm'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: dbm_rnd_read.rb
|
4
|
+
CVS_ID = '$Id: dbm_rnd_read.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/dbm'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: dbm_rnd_update.rb
|
4
|
+
CVS_ID = '$Id: dbm_rnd_update.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/dbm'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: dbm_seq_read.rb
|
4
|
+
CVS_ID = '$Id: dbm_seq_read.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/dbm'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: dbm_seq_write.rb
|
4
|
+
CVS_ID = '$Id: dbm_seq_write.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/dbm'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
5
|
+
|
6
|
+
# for ident(1)
|
7
|
+
CVS_ID = '$Id: run.rb 781 2008-07-28 15:13:27Z toki $'
|
8
|
+
|
9
|
+
require 'fileutils'
|
10
|
+
require 'rbconfig'
|
11
|
+
|
12
|
+
include Config
|
13
|
+
include FileUtils
|
14
|
+
|
15
|
+
LIB_DIR = File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
16
|
+
LOOP_COUNT = ENV['LOOP_COUNT'] || '100'
|
17
|
+
DATA_COUNT = ENV['DATA_COUNT'] || '10'
|
18
|
+
MAX_DAT_LEN = ENV['MAX_DAT_LEN'] || '32768'
|
19
|
+
|
20
|
+
def run(cmd)
|
21
|
+
ruby = CONFIG['RUBY_INSTALL_NAME']
|
22
|
+
system ruby, '-I', LIB_DIR, cmd, LOOP_COUNT, DATA_COUNT, MAX_DAT_LEN
|
23
|
+
end
|
24
|
+
|
25
|
+
def benchmarks
|
26
|
+
print "\n"
|
27
|
+
yield 'dbm_seq_write.rb'
|
28
|
+
run 'st_verify.rb'
|
29
|
+
yield 'dbm_seq_read.rb'
|
30
|
+
run 'st_verify.rb'
|
31
|
+
yield 'dbm_rnd_read.rb'
|
32
|
+
run 'st_verify.rb'
|
33
|
+
yield 'dbm_rnd_update.rb'
|
34
|
+
run 'st_verify.rb'
|
35
|
+
yield 'dbm_rnd_delete.rb'
|
36
|
+
run 'st_verify.rb'
|
37
|
+
#yield 'st_reorganize.rb'
|
38
|
+
#run 'st_verify.rb'
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def clean
|
43
|
+
for db in Dir['foo.*']
|
44
|
+
rm_f db
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
clean
|
49
|
+
|
50
|
+
benchmarks do |rb|
|
51
|
+
run rb
|
52
|
+
end
|
data/misc/dbm_bench/st_verify.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: st_verify.rb
|
4
|
+
CVS_ID = '$Id: st_verify.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/storage'
|
data/misc/io_bench/jlog_bench.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for dient(1)
|
4
|
-
CVS_ID = '$Id: jlog_bench.rb
|
4
|
+
CVS_ID = '$Id: jlog_bench.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'fileutils'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
3
|
# for ident(1)
|
4
|
-
CVS_ID = '$Id: lock_bench.rb
|
4
|
+
CVS_ID = '$Id: lock_bench.rb 781 2008-07-28 15:13:27Z toki $'
|
5
5
|
|
6
|
-
|
6
|
+
$:.unshift File.join(File.dirname($0), '..', '..', 'lib')
|
7
7
|
|
8
8
|
require 'benchmark'
|
9
9
|
require 'higgs/thread'
|
data/test/Rakefile
CHANGED
data/test/run.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
5
5
|
|
6
6
|
# for ident(1)
|
7
|
-
CVS_ID = '$Id: run.rb
|
7
|
+
CVS_ID = '$Id: run.rb 781 2008-07-28 15:13:27Z toki $'
|
8
8
|
|
9
9
|
mask = // # any match
|
10
10
|
if ($0 == __FILE__) then
|
data/test/test_block.rb
CHANGED