hitimes 1.0.5-x86-mingw32 → 1.1.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -0
- data/gemspec.rb +6 -1
- data/lib/hitimes.rb +8 -3
- data/lib/hitimes/1.8/hitimes_ext.so +0 -0
- data/lib/hitimes/1.9/hitimes_ext.so +0 -0
- data/lib/hitimes/version.rb +2 -2
- data/spec/interval_spec.rb +1 -1
- data/spec/timed_metric_spec.rb +5 -5
- data/spec/timed_value_metric_spec.rb +2 -2
- data/spec/value_metric_spec.rb +5 -5
- data/tasks/config.rb +2 -1
- data/tasks/distribution.rake +18 -3
- data/tasks/extension.rake +19 -2
- data/tasks/rspec.rake +3 -1
- metadata +4 -4
data/HISTORY
CHANGED
data/gemspec.rb
CHANGED
@@ -57,4 +57,9 @@ Hitimes::GEM_SPEC_MINGW32= Hitimes::GEM_SPEC.clone
|
|
57
57
|
Hitimes::GEM_SPEC_MINGW32.platform = ::Gem::Platform.new( "i386-mingw32" )
|
58
58
|
Hitimes::GEM_SPEC_MINGW32.extensions = []
|
59
59
|
|
60
|
-
Hitimes::
|
60
|
+
Hitimes::GEM_SPEC_JAVA = Hitimes::GEM_SPEC.clone
|
61
|
+
Hitimes::GEM_SPEC_JAVA.platform = ::Gem::Platform.new( 'java' )
|
62
|
+
Hitimes::GEM_SPEC_JAVA.extensions = []
|
63
|
+
|
64
|
+
Hitimes::SPECS = [ Hitimes::GEM_SPEC, Hitimes::GEM_SPEC_MSWIN32, Hitimes::GEM_SPEC_MINGW32, Hitimes::GEM_SPEC_JAVA ]
|
65
|
+
|
data/lib/hitimes.rb
CHANGED
@@ -19,9 +19,14 @@ end
|
|
19
19
|
require 'hitimes/paths'
|
20
20
|
require 'hitimes/version'
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
if RUBY_PLATFORM == "java" then
|
23
|
+
require 'hitimes/hitimes'
|
24
|
+
else
|
25
|
+
# use a version subdirectory for extensions, initially to support windows, but
|
26
|
+
# why make a special case. It doesn't hurt anyone to have an extra subdir.
|
27
|
+
require "hitimes/#{RUBY_VERSION.sub(/\.\d$/,'')}/hitimes_ext"
|
28
|
+
end
|
29
|
+
|
25
30
|
require 'hitimes/stats'
|
26
31
|
require 'hitimes/mutexed_stats'
|
27
32
|
|
Binary file
|
Binary file
|
data/lib/hitimes/version.rb
CHANGED
data/spec/interval_spec.rb
CHANGED
data/spec/timed_metric_spec.rb
CHANGED
@@ -84,10 +84,10 @@ describe Hitimes::TimedMetric do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it "keeps track of the minimum start time of all the intervals" do
|
87
|
-
f1 = Time.now.gmtime.to_f *
|
87
|
+
f1 = Time.now.gmtime.to_f * 1_000_000
|
88
88
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
89
|
-
f2 = Time.now.gmtime.to_f *
|
90
|
-
@tm.sampling_start_time.should
|
89
|
+
f2 = Time.now.gmtime.to_f * 1_000_000
|
90
|
+
@tm.sampling_start_time.should >= f1
|
91
91
|
@tm.sampling_start_time.should < f2
|
92
92
|
# distance from now to start time should be greater than the distance from
|
93
93
|
# the start to the min start_time
|
@@ -99,7 +99,7 @@ describe Hitimes::TimedMetric do
|
|
99
99
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop }
|
100
100
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
101
101
|
@tm.sampling_stop_time.should > f1
|
102
|
-
@tm.sampling_stop_time.should
|
102
|
+
@tm.sampling_stop_time.should <= f2
|
103
103
|
# distance from now to max stop time time should be less than the distance
|
104
104
|
# from the start to the max stop time
|
105
105
|
(f2 - @tm.sampling_stop_time).should < ( @tm.sampling_stop_time - f1 )
|
@@ -140,7 +140,7 @@ describe Hitimes::TimedMetric do
|
|
140
140
|
it "has the right sum" do
|
141
141
|
10.times { |x| @tm.measure { sleep 0.01*x } }
|
142
142
|
h = @tm.to_hash
|
143
|
-
h['sum'].should be_close( 0.45, 0.
|
143
|
+
h['sum'].should be_close( 0.45, 0.003 )
|
144
144
|
end
|
145
145
|
|
146
146
|
fields = ::Hitimes::Stats::STATS.dup + %w[ name additional_data sampling_start_time sampling_stop_time ]
|
@@ -97,7 +97,7 @@ describe Hitimes::TimedValueMetric do
|
|
97
97
|
f1 = Time.now.gmtime.to_f * 1000000
|
98
98
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop( 1 ) }
|
99
99
|
f2 = Time.now.gmtime.to_f * 1000000
|
100
|
-
@tm.sampling_start_time.should
|
100
|
+
@tm.sampling_start_time.should >= f1
|
101
101
|
@tm.sampling_start_time.should < f2
|
102
102
|
# distance from now to start time should be greater than the distance from
|
103
103
|
# the start to the min start_time
|
@@ -109,7 +109,7 @@ describe Hitimes::TimedValueMetric do
|
|
109
109
|
5.times { @tm.start ; sleep 0.05 ; @tm.stop( 1 ) }
|
110
110
|
f2 = Time.now.gmtime.to_f * 1000000
|
111
111
|
@tm.sampling_stop_time.should > f1
|
112
|
-
@tm.sampling_stop_time.should
|
112
|
+
@tm.sampling_stop_time.should <= f2
|
113
113
|
# distance from now to max stop time time should be less than the distance
|
114
114
|
# from the start to the max stop time
|
115
115
|
(f2 - @tm.sampling_stop_time).should < ( @tm.sampling_stop_time - f1 )
|
data/spec/value_metric_spec.rb
CHANGED
@@ -58,10 +58,10 @@ describe Hitimes::ValueMetric do
|
|
58
58
|
it "keeps track of the first start time of all the measurements" do
|
59
59
|
m = Hitimes::ValueMetric.new( "first-start-time" )
|
60
60
|
f1 = Time.now.gmtime.to_f * 1_000_000
|
61
|
-
10.times{ |x| m.measure( x ) }
|
61
|
+
10.times{ |x| m.measure( x ); sleep 0.1 }
|
62
62
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
63
|
-
m.sampling_start_time.should
|
64
|
-
m.
|
63
|
+
m.sampling_start_time.should >= f1
|
64
|
+
m.sampling_start_time.should < f2
|
65
65
|
# distance from now to start time should be greater than the distance from
|
66
66
|
# the start to the min start_time
|
67
67
|
(f2 - m.sampling_start_time).should > ( m.sampling_start_time - f1 )
|
@@ -70,10 +70,10 @@ describe Hitimes::ValueMetric do
|
|
70
70
|
it "keeps track of the last stop time of all the intervals" do
|
71
71
|
m = Hitimes::ValueMetric.new( "last-stop-time" )
|
72
72
|
f1 = Time.now.gmtime.to_f * 1_000_000
|
73
|
-
10.times {|x| m.measure( x ) }
|
73
|
+
10.times {|x| m.measure( x ); sleep 0.1 }
|
74
74
|
f2 = Time.now.gmtime.to_f * 1_000_000
|
75
75
|
m.sampling_stop_time.should > f1
|
76
|
-
m.sampling_stop_time.should
|
76
|
+
m.sampling_stop_time.should <= f2
|
77
77
|
# distance from now to max stop time time should be less than the distance
|
78
78
|
# from the start to the max stop time
|
79
79
|
(f2 - m.sampling_stop_time).should < ( m.sampling_stop_time - f1 )
|
data/tasks/config.rb
CHANGED
@@ -2,6 +2,7 @@ require 'configuration'
|
|
2
2
|
|
3
3
|
require 'rake'
|
4
4
|
require 'tasks/utils'
|
5
|
+
require 'yaml'
|
5
6
|
|
6
7
|
#-----------------------------------------------------------------------
|
7
8
|
# General project configuration
|
@@ -92,7 +93,7 @@ Configuration.for('rdoc') {
|
|
92
93
|
#-----------------------------------------------------------------------
|
93
94
|
Configuration.for('extension') {
|
94
95
|
configs Configuration.for('packaging').files.ext.find_all { |x| %w[ mkrf_conf.rb extconf.rb ].include?(File.basename(x)) }
|
95
|
-
cross_rbconfig YAML
|
96
|
+
cross_rbconfig ::YAML::load_file( File.expand_path("~/.rake-compiler/config.yml"))
|
96
97
|
}
|
97
98
|
|
98
99
|
#-----------------------------------------------------------------------
|
data/tasks/distribution.rake
CHANGED
@@ -36,11 +36,16 @@ if pkg_config = Configuration.for_if_exist?("packaging") then
|
|
36
36
|
puts Hitimes::GEM_SPEC_WIN.to_ruby
|
37
37
|
end
|
38
38
|
|
39
|
+
desc "dump gemspec for java"
|
40
|
+
task :gemspec_java do
|
41
|
+
puts Hitimes::GEM_SPEC_JAVA.to_ruby
|
42
|
+
end
|
43
|
+
|
39
44
|
desc "reinstall gem"
|
40
45
|
task :reinstall => [:uninstall, :repackage, :install]
|
41
46
|
|
42
47
|
desc "package up a windows gem"
|
43
|
-
task :package_win => :clean
|
48
|
+
task :package_win => :clean do
|
44
49
|
Configuration.for("extension").cross_rbconfig.keys.each do |rbconfig|
|
45
50
|
v = rbconfig.split("-").last
|
46
51
|
s = v.sub(/\.\d$/,'')
|
@@ -58,15 +63,25 @@ if pkg_config = Configuration.for_if_exist?("packaging") then
|
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
66
|
+
if RUBY_PLATFORM == "java" then
|
67
|
+
desc "package up a jruby gem"
|
68
|
+
task :package_java => "ext:build_java" do
|
69
|
+
Hitimes::GEM_SPEC_JAVA.files += FileList["lib/hitimes/java/*.jar"]
|
70
|
+
Gem::Builder.new( Hitimes::GEM_SPEC_JAVA ).build
|
71
|
+
mv Dir["*.gem"].first, "pkg"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
61
75
|
task :clobber do
|
62
76
|
rm_rf "lib/hitimes/1.8"
|
63
77
|
rm_rf "lib/hitimes/1.9"
|
78
|
+
rm_rf "lib/hitimes/*.jar"
|
64
79
|
end
|
65
80
|
|
66
|
-
task :prep => [:clean, :package, :package_win]
|
81
|
+
task :prep => [:clean, :package, :package_win, :package_java ]
|
67
82
|
|
68
83
|
desc "distribute copiously"
|
69
|
-
task :copious => [:clean, :package, :package_win ] do
|
84
|
+
task :copious => [:clean, :package, :package_win, :package_java ] do
|
70
85
|
gems = Hitimes::SPECS.collect { |s| "#{s.full_name}.gem" }
|
71
86
|
Rake::SshFilePublisher.new('jeremy@copiousfreetime.org',
|
72
87
|
'/var/www/vhosts/www.copiousfreetime.org/htdocs/gems/gems',
|
data/tasks/extension.rake
CHANGED
@@ -8,7 +8,7 @@ require 'pathname'
|
|
8
8
|
if ext_config = Configuration.for_if_exist?('extension') then
|
9
9
|
namespace :ext do
|
10
10
|
desc "Build the extension(s)"
|
11
|
-
task :build => :
|
11
|
+
task :build => :clobber do
|
12
12
|
ext_config.configs.each do |extension|
|
13
13
|
path = Pathname.new(extension)
|
14
14
|
parts = path.split
|
@@ -26,6 +26,23 @@ if ext_config = Configuration.for_if_exist?('extension') then
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
if RUBY_PLATFORM == "java" then
|
30
|
+
desc "Build the jruby extension"
|
31
|
+
task :build_java => [ :clobber, "lib/hitimes/hitimes.jar" ]
|
32
|
+
|
33
|
+
file "lib/hitimes/hitimes.jar" => FileList["ext/java/src/hitimes/*.java"] do |t|
|
34
|
+
jruby_home = Config::CONFIG['prefix']
|
35
|
+
jruby_jar = File.join( jruby_home, 'lib', 'jruby.jar' )
|
36
|
+
|
37
|
+
mkdir_p 'pkg/classes'
|
38
|
+
sh "javac -classpath #{jruby_jar} -d pkg/classes #{t.prerequisites.join(' ')}"
|
39
|
+
|
40
|
+
dest_dir = File.dirname(t.name)
|
41
|
+
sh "jar cf #{t.name} -C pkg/classes ."
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
29
46
|
def build_win( version = "1.8.6" )
|
30
47
|
ext_config = Configuration.for("extension")
|
31
48
|
rbconfig = ext_config.cross_rbconfig["rbconfig-#{version}"]
|
@@ -34,7 +51,7 @@ if ext_config = Configuration.for_if_exist?('extension') then
|
|
34
51
|
path = Pathname.new(extension)
|
35
52
|
parts = path.split
|
36
53
|
conf = parts.last
|
37
|
-
rvm =
|
54
|
+
rvm = File.expand_path( "~/.rvm/bin/rvm" )
|
38
55
|
Dir.chdir(path.dirname) do |d|
|
39
56
|
if File.exist?( "Makefile" ) then
|
40
57
|
sh "make clean distclean"
|
data/tasks/rspec.rake
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hitimes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.5
|
10
|
+
version: 1.1.0
|
11
11
|
platform: x86-mingw32
|
12
12
|
authors:
|
13
13
|
- Jeremy Hinegardner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-28 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|