hitimes 1.0.3-x86-mswin32-60 → 1.2.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.travis.yml +10 -0
  2. data/CONTRIBUTING.md +45 -0
  3. data/HISTORY.md +97 -0
  4. data/LICENSE +11 -8
  5. data/Manifest.txt +45 -0
  6. data/README.md +163 -0
  7. data/Rakefile +23 -62
  8. data/ext/hitimes/c/extconf.rb +24 -0
  9. data/ext/hitimes/{hitimes_ext.c → c/hitimes.c} +1 -1
  10. data/ext/hitimes/{hitimes_instant_clock_gettime.c → c/hitimes_instant_clock_gettime.c} +0 -0
  11. data/ext/hitimes/c/hitimes_instant_osx.c +45 -0
  12. data/ext/hitimes/{hitimes_instant_windows.c → c/hitimes_instant_windows.c} +0 -0
  13. data/ext/hitimes/{hitimes_interval.c → c/hitimes_interval.c} +15 -7
  14. data/ext/hitimes/{hitimes_interval.h → c/hitimes_interval.h} +5 -5
  15. data/ext/hitimes/{hitimes_stats.c → c/hitimes_stats.c} +0 -0
  16. data/ext/hitimes/{hitimes_stats.h → c/hitimes_stats.h} +0 -0
  17. data/ext/hitimes/java/src/hitimes/Hitimes.java +54 -0
  18. data/ext/hitimes/java/src/hitimes/HitimesInterval.java +181 -0
  19. data/ext/hitimes/java/src/hitimes/HitimesService.java +16 -0
  20. data/ext/hitimes/java/src/hitimes/HitimesStats.java +112 -0
  21. data/lib/hitimes.rb +18 -5
  22. data/lib/hitimes/1.9/hitimes.so +0 -0
  23. data/lib/hitimes/2.0/hitimes.so +0 -0
  24. data/lib/hitimes/2.1/hitimes.so +0 -0
  25. data/lib/hitimes/metric.rb +6 -0
  26. data/lib/hitimes/mutexed_stats.rb +5 -1
  27. data/lib/hitimes/stats.rb +5 -1
  28. data/lib/hitimes/timed_metric.rb +1 -2
  29. data/lib/hitimes/timed_value_metric.rb +0 -2
  30. data/lib/hitimes/value_metric.rb +2 -3
  31. data/lib/hitimes/version.rb +1 -50
  32. data/spec/hitimes_spec.rb +14 -0
  33. data/spec/interval_spec.rb +40 -37
  34. data/spec/metric_spec.rb +8 -10
  35. data/spec/mutex_stats_spec.rb +10 -8
  36. data/spec/paths_spec.rb +3 -5
  37. data/spec/spec_helper.rb +9 -4
  38. data/spec/stats_spec.rb +28 -30
  39. data/spec/timed_metric_spec.rb +44 -44
  40. data/spec/timed_value_metric_spec.rb +54 -55
  41. data/spec/value_metric_spec.rb +28 -30
  42. data/spec/version_spec.rb +4 -30
  43. data/tasks/default.rake +254 -0
  44. data/tasks/extension.rake +29 -73
  45. data/tasks/this.rb +200 -0
  46. metadata +173 -105
  47. data/HISTORY +0 -55
  48. data/README +0 -134
  49. data/ext/hitimes/extconf.rb +0 -21
  50. data/ext/hitimes/hitimes_instant_osx.c +0 -16
  51. data/gemspec.rb +0 -57
  52. data/lib/hitimes/1.8/hitimes_ext.so +0 -0
  53. data/lib/hitimes/1.9/hitimes_ext.so +0 -0
  54. data/tasks/announce.rake +0 -39
  55. data/tasks/config.rb +0 -108
  56. data/tasks/distribution.rake +0 -74
  57. data/tasks/documentation.rake +0 -32
  58. data/tasks/rspec.rake +0 -31
  59. data/tasks/rubyforge.rake +0 -55
  60. data/tasks/utils.rb +0 -80
data/HISTORY DELETED
@@ -1,55 +0,0 @@
1
- = Changelog
2
- == Version 1.0.3 2009-06-28
3
-
4
- * Fix bug with time.h on linode (reported by Roger Pack)
5
- * Fix potential garbage collection issue with Interval class
6
- * Windows gem is now a fat binary to support installing in 1.8 or 1.9 from the
7
- same gem
8
-
9
- == Version 1.0.1 2009-06-12
10
-
11
- * Fix examples
12
- * performance tuning, new Hitimes::Metric derived classes are faster than old Timer class
13
-
14
- == Version 1.0.0 2009-06-12
15
-
16
- * Major version bump with complete refactor of the metric collection API
17
- * 3 types of metrics now instead of just 1 Timer
18
- * Hitimes::ValueMetric
19
- * Hitimes::TimedMetric
20
- * Hitimes::TimedValueMetric
21
- * The ability to convert all metrics #to_hash
22
- * Updated documentation with examples using each metric type
23
-
24
- == Version 0.4.1 2009-02-19
25
-
26
- * change to ISC License
27
- * fix bug in compilation on gentoo
28
-
29
- == Version 0.4.0 2008-12-20
30
-
31
- * Added new stat 'rate'
32
- * Added new stat method to_hash
33
- * Added Hitimes::MutexedStats class for threadsafe stats collection
34
- - not needed when used in MRI 1.8.x
35
- * remove stale dependency on mkrf
36
-
37
- == Version 0.3.0
38
-
39
- * switched to extconf for building extensions
40
- * first release of windows binary gem
41
- * reverted back to normal rdoc
42
-
43
- == Version 0.2.1
44
-
45
- * added Timer#rate method
46
- * switched to darkfish rdoc
47
-
48
- == Version 0.2.0
49
-
50
- * Performance improvements
51
- * Added Hitimes::Stats class
52
-
53
- == Version 0.1.0
54
-
55
- * Initial completion
data/README DELETED
@@ -1,134 +0,0 @@
1
- == hitimes
2
-
3
- * Homepage[http://copiousfreetime.rubyforge.org/hitimes]
4
- * {Rubyforge project}[http://rubyforge.org/projects/copiousfreetime/]
5
- * email jeremy at copiousfreetime dot org
6
- * git clone url git://github.com/copiousfreetime/hitimes.git
7
-
8
- == INSTALL
9
-
10
- * gem install hitimes
11
-
12
- == DESCRIPTION
13
-
14
- Hitimes is a fast, high resolution timer library for recording
15
- performance metrics. It uses the appropriate C method calls for each
16
- system to get the highest granularity time increments possible.
17
-
18
- It currently supports any of the following systems:
19
-
20
- * any system with the POSIX call <tt>clock_gettime()</tt>,
21
- * Mac OS X
22
- * Windows
23
-
24
- Using Hitimes can be faster than using a series of +Time.new+ calls, and
25
- it will have a much higher granularity. It is definitely faster than
26
- using +Process.times+.
27
-
28
- == SYNOPSIS
29
-
30
- === Interval
31
-
32
- Use Hitimes::Interval to calculate only the duration of a block of code
33
-
34
- duration = Hitimes::Interval.measure do
35
- # some operation ...
36
- end
37
-
38
- puts duration
39
-
40
- === TimedMetric
41
-
42
- Use a Hitimes::TimedMetric to calculate statistics about an iterative operation
43
-
44
- timed_metric = Hitimes::TimedMetric.new('operation on items')
45
-
46
- Explicitly use +start+ and +stop+:
47
-
48
- collection.each do |item|
49
- timed_metric.start
50
- # .. do something with item
51
- timed_metric.stop
52
- end
53
-
54
- Or use the block. In TimedMetric the return value of +measure+ is the return
55
- value of the block
56
-
57
- collection.each do |item|
58
- result_of_do_something = timed_metric.measure { do_something( item ) }
59
- end
60
-
61
- And then look at the stats
62
-
63
- puts timed_metric.mean
64
- puts timed_metric.max
65
- puts timed_metric.min
66
- puts timed_metric.stddev
67
- puts timed_metric.rate
68
-
69
- === ValueMetric
70
-
71
- Use a Hitimes::ValueMetric to calculate statistics about measured samples
72
-
73
- value_metric = Hitimes::ValueMetric.new( 'size of thing' )
74
- loop do
75
- # ... do stuff changing sizes of 'thing'
76
- value_metric.measure( thing.size )
77
- # ... do other stuff that may change size of thing
78
- end
79
-
80
- puts value_metric.mean
81
- puts value_metric.max
82
- puts value_metric.min
83
- puts value_metric.stddev
84
- puts value_metric.rate
85
-
86
-
87
- === TimedValueMetric
88
-
89
- Use a Hitimes::TimedValueMetric to calculate statistics about batches of samples
90
-
91
- timed_value_metric = Hitimes::TimedValueMetric.new( 'batch times' )
92
- loop do
93
- batch = ... # get a batch of things
94
- timed_value_metric.start
95
- # .. do something with batch
96
- timed_value_metric.stop( batch.size )
97
- end
98
-
99
- puts timed_value_metric.rate
100
-
101
- puts timed_value_metric.timed_stats.mean
102
- puts timed_value_metric.timed_stats.max
103
- puts timed_value_metric.timed_stats.min
104
- puts timed_value_metric.timed_stats.stddev
105
-
106
- puts timed_value_metric.value_stats.mean
107
- puts timed_value_metric.value_stats.max
108
- puts timed_value_metric.value_stats.min
109
- puts timed_value_metric.value_stats.stddev
110
-
111
-
112
- == CHANGES
113
-
114
- Read the HISTORY file.
115
-
116
- == CREDITS
117
-
118
- * Bruce Williams for suggesting the idea
119
-
120
- == ISC License
121
-
122
- Copyright (c) 2008 Jeremy Hinegardner
123
-
124
- Permission to use, copy, modify, and/or distribute this software for any
125
- purpose with or without fee is hereby granted, provided that the above
126
- copyright notice and this permission notice appear in all copies.
127
-
128
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
129
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
130
- FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
131
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
132
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
133
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
134
- PERFORMANCE OF THIS SOFTWARE.
@@ -1,21 +0,0 @@
1
- require 'rbconfig'
2
- require 'mkmf'
3
-
4
- if Config::CONFIG['host_os'] =~ /darwin/ then
5
- $CFLAGS += " -DUSE_INSTANT_OSX=1 -Wall"
6
- $LDFLAGS += " -framework CoreServices"
7
- elsif Config::CONFIG['host_os'] =~ /win32/ or Config::CONFIG['host_os'] =~ /mingw/ then
8
- $CFLAGS += " -DUSE_INSTANT_WINDOWS=1"
9
- else
10
- if have_library("rt", "clock_gettime") then
11
- $CFLAGS += " -DUSE_INSTANT_CLOCK_GETTIME=1"
12
- end
13
- end
14
-
15
- # put in a different location if on windows so we can have fat binaries
16
- parent_dir = "hitimes"
17
- if RUBY_PLATFORM =~ /(mswin|mingw)/i then
18
- v = RUBY_VERSION.gsub(/\.\d$/,'')
19
- parent_dir = File.join( parent_dir, v )
20
- end
21
- create_makefile("#{parent_dir}/hitimes_ext")
@@ -1,16 +0,0 @@
1
- #ifdef USE_INSTANT_OSX
2
-
3
- #include "hitimes_interval.h"
4
- #include <CoreServices/CoreServices.h>
5
-
6
- /*
7
- * returns the number of nanoseconds since the machine was booted
8
- */
9
- hitimes_instant_t hitimes_get_current_instant( )
10
- {
11
- Nanoseconds nano = AbsoluteToNanoseconds( UpTime() );
12
-
13
- return *( hitimes_instant_t *)&nano;
14
- }
15
-
16
- #endif
data/gemspec.rb DELETED
@@ -1,57 +0,0 @@
1
- require 'rubygems'
2
- require 'hitimes/version'
3
- require 'tasks/config'
4
-
5
- Hitimes::GEM_SPEC = Gem::Specification.new do |spec|
6
- proj = Configuration.for('project')
7
- spec.name = proj.name
8
- spec.version = Hitimes::VERSION
9
-
10
- spec.author = proj.author
11
- spec.email = proj.email
12
- spec.homepage = proj.homepage
13
- spec.summary = proj.summary
14
- spec.description = proj.description
15
- spec.platform = Gem::Platform::RUBY
16
-
17
-
18
- pkg = Configuration.for('packaging')
19
- spec.files = pkg.files.all
20
- spec.executables = pkg.files.bin.collect { |b| File.basename(b) }
21
-
22
- # add dependencies here
23
- spec.add_dependency("rake", "~> 0.8.1")
24
- spec.add_dependency("configuration", " ~> 0.0.5")
25
-
26
- spec.add_development_dependency( "json", "~> 1.1.3")
27
- spec.add_development_dependency( "rake-compiler", "~> 0.5.0")
28
-
29
- if ext_conf = Configuration.for_if_exist?("extension") then
30
- spec.extensions << ext_conf.configs
31
- spec.require_paths << 'ext'
32
- spec.extensions.flatten!
33
- end
34
-
35
- if rdoc = Configuration.for_if_exist?('rdoc') then
36
- spec.has_rdoc = true
37
- spec.extra_rdoc_files = pkg.files.rdoc
38
- spec.rdoc_options = rdoc.options + [ "--main" , rdoc.main_page ]
39
- else
40
- spec.has_rdoc = false
41
- end
42
-
43
- if test = Configuration.for_if_exist?('testing') then
44
- spec.test_files = test.files
45
- end
46
-
47
- if rf = Configuration.for_if_exist?('rubyforge') then
48
- spec.rubyforge_project = rf.project
49
- end
50
- end
51
-
52
- Hitimes::GEM_SPEC_WIN = Hitimes::GEM_SPEC.clone
53
- Hitimes::GEM_SPEC_WIN.platform = ::Gem::Platform.new( "i386-mswin32_60" )
54
- Hitimes::GEM_SPEC_WIN.extensions = []
55
- #Hitimes::GEM_SPEC_WIN.files +=
56
-
57
- Hitimes::SPECS = [ Hitimes::GEM_SPEC, Hitimes::GEM_SPEC_WIN ]
@@ -1,39 +0,0 @@
1
- require 'tasks/config'
2
- #-------------------------------------------------------------------------------
3
- # announcement methods
4
- #-------------------------------------------------------------------------------
5
-
6
- proj_config = Configuration.for('project')
7
- namespace :announce do
8
- desc "create email for ruby-talk"
9
- task :email do
10
- info = Utils.announcement
11
-
12
- File.open("email.txt", "w") do |mail|
13
- mail.puts "From: #{proj_config.author} <#{proj_config.email}>"
14
- mail.puts "To: ruby-talk@ruby-lang.org"
15
- mail.puts "Date: #{Time.now.rfc2822}"
16
- mail.puts "Subject: [ANN] #{info[:subject]}"
17
- mail.puts
18
- mail.puts info[:title]
19
- mail.puts
20
- mail.puts " gem install #{Hitimes::GEM_SPEC.name}"
21
- mail.puts
22
- mail.puts info[:urls]
23
- mail.puts
24
- mail.puts info[:description]
25
- mail.puts
26
- mail.puts "{{ Release notes for Version #{Hitimes::VERSION} }}"
27
- mail.puts
28
- mail.puts info[:release_notes]
29
- mail.puts
30
- end
31
- puts "Created the following as email.txt:"
32
- puts "-" * 72
33
- puts File.read("email.txt")
34
- puts "-" * 72
35
- end
36
-
37
- CLOBBER << "email.txt"
38
- end
39
-
@@ -1,108 +0,0 @@
1
- require 'configuration'
2
-
3
- require 'rake'
4
- require 'tasks/utils'
5
-
6
- #-----------------------------------------------------------------------
7
- # General project configuration
8
- #-----------------------------------------------------------------------
9
- Configuration.for('project') {
10
- name "hitimes"
11
- version Hitimes::Version.to_s
12
- author "Jeremy Hinegardner"
13
- email "jeremy at copiousfreetime dot org"
14
- homepage "http://copiousfreetime.rubyforge.org/hitimes/"
15
- description Utils.section_of("README", "description")
16
- summary description.split(".").first
17
- history "HISTORY"
18
- license FileList["LICENSE"]
19
- readme "README"
20
- }
21
-
22
- #-----------------------------------------------------------------------
23
- # Packaging
24
- #-----------------------------------------------------------------------
25
- Configuration.for('packaging') {
26
- # files in the project
27
- proj_conf = Configuration.for('project')
28
- files {
29
- bin FileList["bin/*"]
30
- ext FileList["ext/hitimes/*.{c,h,rb}"]
31
- examples FileList["examples/*.rb"]
32
- lib FileList["lib/**/*.rb"]
33
- test FileList["spec/**/*.rb", "test/**/*.rb"]
34
- data FileList["data/**/*"]
35
- tasks FileList["tasks/**/*.r{ake,b}"]
36
- rdoc FileList[proj_conf.readme, proj_conf.history,
37
- proj_conf.license] + lib + FileList["ext/*.c"]
38
- all bin + examples + ext + lib + test + data + rdoc + tasks + FileList["Rakefile"]
39
- }
40
-
41
- # ways to package the results
42
- formats {
43
- tgz true
44
- zip true
45
- rubygem Configuration::Table.has_key?('gem')
46
- }
47
- }
48
-
49
- #-----------------------------------------------------------------------
50
- # Gem packaging
51
- #-----------------------------------------------------------------------
52
- Configuration.for("gem") {
53
- spec "gemspec.rb"
54
- Configuration.for('packaging').files.all << spec
55
- }
56
-
57
- #-----------------------------------------------------------------------
58
- # Testing
59
- # - change mode to 'testunit' to use unit testing
60
- #-----------------------------------------------------------------------
61
- Configuration.for('test') {
62
- mode "spec"
63
- files Configuration.for("packaging").files.test
64
- options %w[ --format specdoc --color ]
65
- ruby_opts %w[ ]
66
- }
67
-
68
- #-----------------------------------------------------------------------
69
- # Rcov
70
- #-----------------------------------------------------------------------
71
- Configuration.for('rcov') {
72
- output_dir "coverage"
73
- libs %w[ lib ]
74
- rcov_opts %w[ --html ]
75
- ruby_opts %w[ ]
76
- test_files Configuration.for('packaging').files.test
77
- }
78
-
79
- #-----------------------------------------------------------------------
80
- # Rdoc
81
- #-----------------------------------------------------------------------
82
- Configuration.for('rdoc') {
83
- files Configuration.for('packaging').files.rdoc
84
- main_page files.first
85
- title Configuration.for('project').name
86
- options %w[ --line-numbers ]
87
- output_dir "doc"
88
- }
89
-
90
- #-----------------------------------------------------------------------
91
- # Extension
92
- #-----------------------------------------------------------------------
93
- Configuration.for('extension') {
94
- configs Configuration.for('packaging').files.ext.find_all { |x| %w[ mkrf_conf.rb extconf.rb ].include?(File.basename(x)) }
95
- cross_rbconfig YAML.load_file( File.expand_path("~/.rake-compiler/config.yml"))
96
- }
97
-
98
- #-----------------------------------------------------------------------
99
- # Rubyforge
100
- #-----------------------------------------------------------------------
101
- Configuration.for('rubyforge') {
102
- project "copiousfreetime"
103
- user "jjh"
104
- host "rubyforge.org"
105
- rdoc_location "#{user}@#{host}:/var/www/gforge-projects/#{project}/hitimes"
106
- }
107
-
108
-
@@ -1,74 +0,0 @@
1
- require 'tasks/config'
2
-
3
- #-------------------------------------------------------------------------------
4
- # Distribution and Packaging
5
- #-------------------------------------------------------------------------------
6
- if pkg_config = Configuration.for_if_exist?("packaging") then
7
-
8
- require 'gemspec'
9
- require 'rake/gempackagetask'
10
- require 'rake/contrib/sshpublisher'
11
-
12
- namespace :dist do
13
-
14
- Rake::GemPackageTask.new(Hitimes::GEM_SPEC) do |pkg|
15
- pkg.need_tar = pkg_config.formats.tgz
16
- pkg.need_zip = pkg_config.formats.zip
17
- end
18
-
19
- desc "Install as a gem"
20
- task :install => [:clobber, :package] do
21
- sh "sudo gem install pkg/#{Hitimes::GEM_SPEC.full_name}.gem"
22
- end
23
-
24
- desc "Uninstall gem"
25
- task :uninstall do
26
- sh "sudo gem uninstall -x #{Hitimes::GEM_SPEC.name}"
27
- end
28
-
29
- desc "dump gemspec"
30
- task :gemspec do
31
- puts Hitimes::GEM_SPEC.to_ruby
32
- end
33
-
34
- desc "dump gemspec for win"
35
- task :gemspec_win do
36
- puts Hitimes::GEM_SPEC_WIN.to_ruby
37
- end
38
-
39
- desc "reinstall gem"
40
- task :reinstall => [:uninstall, :repackage, :install]
41
-
42
- desc "package up a windows gem"
43
- task :package_win => :clean do
44
- Configuration.for("extension").cross_rbconfig.keys.each do |rbconfig|
45
- v = rbconfig.split("-").last
46
- s = v.sub(/\.\d$/,'')
47
- sh "rake ext:build_win-#{v}"
48
- mkdir_p "lib/hitimes/#{s}", :verbose => true
49
- cp "ext/hitimes/hitimes_ext.so", "lib/hitimes/#{s}/", :verbose => true
50
- end
51
-
52
- Hitimes::GEM_SPEC_WIN.files += FileList["lib/hitimes/{1.8,1.9}/**.{dll,so}"]
53
- Gem::Builder.new( Hitimes::GEM_SPEC_WIN ).build
54
- mkdir "pkg" unless File.directory?( 'pkg' )
55
- mv Dir["*.gem"].first, "pkg"
56
- end
57
-
58
- task :clobber do
59
- rm_rf "lib/hitimes/1.8"
60
- rm_rf "lib/hitimes/1.9"
61
- end
62
-
63
- task :prep => [:clean, :package, :package_win]
64
-
65
- desc "distribute copiously"
66
- task :copious => [:clean, :package, :package_win ] do
67
- gems = Hitimes::SPECS.collect { |s| "#{s.full_name}.gem" }
68
- Rake::SshFilePublisher.new('jeremy@copiousfreetime.org',
69
- '/var/www/vhosts/www.copiousfreetime.org/htdocs/gems/gems',
70
- 'pkg', *gems).upload
71
- sh "ssh jeremy@copiousfreetime.org rake -f /var/www/vhosts/www.copiousfreetime.org/htdocs/gems/Rakefile"
72
- end
73
- end
74
- end