hitimes 1.3.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +57 -0
  3. data/HISTORY.md +124 -0
  4. data/LICENSE +16 -0
  5. data/Manifest.txt +44 -0
  6. data/README.md +200 -0
  7. data/Rakefile +28 -0
  8. data/examples/benchmarks.rb +113 -0
  9. data/examples/stats.rb +31 -0
  10. data/ext/hitimes/c/extconf.rb +24 -0
  11. data/ext/hitimes/c/hitimes.c +37 -0
  12. data/ext/hitimes/c/hitimes_instant_clock_gettime.c +28 -0
  13. data/ext/hitimes/c/hitimes_instant_osx.c +45 -0
  14. data/ext/hitimes/c/hitimes_instant_windows.c +27 -0
  15. data/ext/hitimes/c/hitimes_interval.c +370 -0
  16. data/ext/hitimes/c/hitimes_interval.h +73 -0
  17. data/ext/hitimes/c/hitimes_stats.c +269 -0
  18. data/ext/hitimes/c/hitimes_stats.h +30 -0
  19. data/ext/hitimes/java/src/hitimes/Hitimes.java +66 -0
  20. data/ext/hitimes/java/src/hitimes/HitimesInterval.java +176 -0
  21. data/ext/hitimes/java/src/hitimes/HitimesService.java +16 -0
  22. data/ext/hitimes/java/src/hitimes/HitimesStats.java +112 -0
  23. data/lib/hitimes.rb +66 -0
  24. data/lib/hitimes/2.0/hitimes.so +0 -0
  25. data/lib/hitimes/2.1/hitimes.so +0 -0
  26. data/lib/hitimes/2.2/hitimes.so +0 -0
  27. data/lib/hitimes/2.3/hitimes.so +0 -0
  28. data/lib/hitimes/2.4/hitimes.so +0 -0
  29. data/lib/hitimes/2.5/hitimes.so +0 -0
  30. data/lib/hitimes/metric.rb +118 -0
  31. data/lib/hitimes/mutexed_stats.rb +32 -0
  32. data/lib/hitimes/paths.rb +53 -0
  33. data/lib/hitimes/stats.rb +58 -0
  34. data/lib/hitimes/timed_metric.rb +176 -0
  35. data/lib/hitimes/timed_value_metric.rb +233 -0
  36. data/lib/hitimes/value_metric.rb +71 -0
  37. data/lib/hitimes/version.rb +8 -0
  38. data/spec/hitimes_spec.rb +24 -0
  39. data/spec/interval_spec.rb +136 -0
  40. data/spec/metric_spec.rb +28 -0
  41. data/spec/mutex_stats_spec.rb +36 -0
  42. data/spec/paths_spec.rb +11 -0
  43. data/spec/spec_helper.rb +11 -0
  44. data/spec/stats_spec.rb +98 -0
  45. data/spec/timed_metric_spec.rb +155 -0
  46. data/spec/timed_value_metric_spec.rb +171 -0
  47. data/spec/value_metric_spec.rb +108 -0
  48. data/spec/version_spec.rb +7 -0
  49. data/tasks/default.rake +242 -0
  50. data/tasks/extension.rake +38 -0
  51. data/tasks/this.rb +208 -0
  52. metadata +216 -0
@@ -0,0 +1,38 @@
1
+ # To be used if the gem has extensions.
2
+ # If this task set is inclueded then you will need to also have
3
+ #
4
+ # spec.add_development_dependency( 'rake-compiler', '~> 0.8.1' )
5
+ #
6
+ # in your top level rakefile
7
+ begin
8
+ require 'rake/extensiontask'
9
+ require 'rake/javaextensiontask'
10
+
11
+ if RUBY_PLATFORM == "java" then
12
+
13
+ Rake::JavaExtensionTask.new( This.name) do |ext|
14
+ ext.ext_dir = File.join( 'ext', This.name, "java" )
15
+ ext.lib_dir = File.join( 'lib', This.name )
16
+ ext.gem_spec = This.java_gemspec
17
+ end
18
+
19
+ else
20
+
21
+ Rake::ExtensionTask.new( This.name ) do |ext|
22
+ ext.ext_dir = File.join( 'ext', This.name, "c" )
23
+ ext.lib_dir = File.join( 'lib', This.name )
24
+ ext.gem_spec = This.ruby_gemspec
25
+
26
+ ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
27
+ ext.cross_platform = %w[x86-mingw32 x64-mingw32] # forces the Windows platform instead of the default one
28
+ # configure options only for cross compile
29
+ end
30
+ end
31
+
32
+ task :test_requirements => :compile
33
+ rescue LoadError
34
+ This.task_warning( 'extension' )
35
+ end
36
+
37
+ CLOBBER << FileList["lib/**/*.{jar,so,bundle}"]
38
+ CLOBBER << FileList["lib/#{This.name}/{1,2}.*/"]
@@ -0,0 +1,208 @@
1
+ require 'pathname'
2
+
3
+ # Public: A Class containing all the metadata and utilities needed to manage a
4
+ # ruby project.
5
+ class ThisProject
6
+ # The name of this project
7
+ attr_accessor :name
8
+
9
+ # The author's name
10
+ attr_accessor :author
11
+
12
+ # The email address of the author(s)
13
+ attr_accessor :email
14
+
15
+ # The homepage of this project
16
+ attr_accessor :homepage
17
+
18
+ # The regex of files to exclude from the manifest
19
+ attr_accessor :exclude_from_manifest
20
+
21
+ # The hash of Gem::Specifications keyed' by platform
22
+ attr_accessor :gemspecs
23
+
24
+ # Public: Initialize ThisProject
25
+ #
26
+ # Yields self
27
+ def initialize(&block)
28
+ @exclude_from_manifest = Regexp.union(/\.(git|DS_Store)/,
29
+ /^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)/,
30
+ /^[^\/]+\.gemspec/,
31
+ /\.(swp|jar|bundle|so|rvmrc|travis.yml)$/,
32
+ /~$/)
33
+ @gemspecs = Hash.new
34
+ yield self if block_given?
35
+ end
36
+
37
+ # Public: return the version of ThisProject
38
+ #
39
+ # Search the ruby files in the project looking for the one that has the
40
+ # version string in it. This does not eval any code in the project, it parses
41
+ # the source code looking for the string.
42
+ #
43
+ # Returns a String version
44
+ def version
45
+ [ "lib/#{ name }.rb", "lib/#{ name }/version.rb" ].each do |v|
46
+ path = project_path( v )
47
+ line = path.read[/^\s*VERSION\s*=\s*.*/]
48
+ if line then
49
+ return line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
50
+ end
51
+ end
52
+ end
53
+
54
+ # Internal: Return a section of an RDoc file with the given section name
55
+ #
56
+ # path - the relative path in the project of the file to parse
57
+ # section_name - the section out of the file from which to parse data
58
+ #
59
+ # Retuns the text of the section as an array of paragrphs.
60
+ def section_of( file, section_name )
61
+ re = /^[=#]+ (.*)$/
62
+ sectional = project_path( file )
63
+ parts = sectional.read.split( re )[1..-1]
64
+ parts.map! { |p| p.strip }
65
+
66
+ sections = Hash.new
67
+ Hash[*parts].each do |k,v|
68
+ sections[k] = v.split("\n\n")
69
+ end
70
+ return sections[section_name]
71
+ end
72
+
73
+ # Internal: print out a warning about the give task
74
+ def task_warning( task )
75
+ warn "WARNING: '#{task}' tasks are not defined. Please run 'rake develop'"
76
+ end
77
+
78
+ # Internal: Return the full path to the file that is relative to the project
79
+ # root.
80
+ #
81
+ # path - the relative path of the file from the project root
82
+ #
83
+ # Returns the Pathname of the file
84
+ def project_path( *relative_path )
85
+ project_root.join( *relative_path )
86
+ end
87
+
88
+ # Internal: The absolute path of this file
89
+ #
90
+ # Returns the Pathname of this file.
91
+ def this_file_path
92
+ Pathname.new( __FILE__ ).expand_path
93
+ end
94
+
95
+ # Internal: The root directory of this project
96
+ #
97
+ # This is defined as being the directory that is in the path of this project
98
+ # that has the first Rakefile
99
+ #
100
+ # Returns the Pathname of the directory
101
+ def project_root
102
+ this_file_path.ascend do |p|
103
+ rakefile = p.join( 'Rakefile' )
104
+ return p if rakefile.exist?
105
+ end
106
+ end
107
+
108
+ # Internal: Returns the contents of the Manifest.txt file as an array
109
+ #
110
+ # Returns an Array of strings
111
+ def manifest
112
+ manifest_file = project_path( "Manifest.txt" )
113
+ abort "You need a Manifest.txt" unless manifest_file.readable?
114
+ manifest_file.readlines.map { |l| l.strip }
115
+ end
116
+
117
+ # Internal: Return the files that define the extensions
118
+ #
119
+ # Returns an Array
120
+ def extension_conf_files
121
+ manifest.grep( /extconf.rb\Z/ )
122
+ end
123
+
124
+ # Internal: Returns the gemspace associated with the current ruby platform
125
+ def platform_gemspec
126
+ gemspecs.fetch(platform) { This.ruby_gemspec }
127
+ end
128
+
129
+ def core_gemspec
130
+ Gem::Specification.new do |spec|
131
+ spec.name = name
132
+ spec.version = version
133
+ spec.author = author
134
+ spec.email = email
135
+ spec.homepage = homepage
136
+
137
+ spec.summary = summary
138
+ spec.description = description
139
+ spec.license = license
140
+
141
+ spec.files = manifest
142
+ spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
143
+ spec.test_files = spec.files.grep(/^spec/)
144
+
145
+ spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc|md)$/)
146
+ spec.rdoc_options = [ "--main" , 'README.md',
147
+ "--markup", "tomdoc" ]
148
+
149
+ spec.required_ruby_version = '>= 1.9.3'
150
+ end
151
+ end
152
+
153
+ # Internal: Return the gemspec for the ruby platform
154
+ def ruby_gemspec( core = core_gemspec, &block )
155
+ yielding_gemspec( 'ruby', core, &block )
156
+ end
157
+
158
+ # Internal: Return the gemspec for the jruby platform
159
+ def java_gemspec( core = core_gemspec, &block )
160
+ yielding_gemspec( 'java', core, &block )
161
+ end
162
+
163
+ # Internal: give an initial spec and a key, create a new gemspec based off of
164
+ # it.
165
+ #
166
+ # This will force the new gemspecs 'platform' to be that of the key, since the
167
+ # only reason you would have multiple gemspecs at this point is to deal with
168
+ # different platforms.
169
+ def yielding_gemspec( key, core )
170
+ spec = gemspecs[key] ||= core.dup
171
+ spec.platform = key
172
+ yield spec if block_given?
173
+ return spec
174
+ end
175
+
176
+ # Internal: Return the platform of ThisProject at the current moment in time.
177
+ def platform
178
+ (RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
179
+ end
180
+
181
+ # Internal: Return the DESCRIPTION section of the README.rdoc file
182
+ def description_section
183
+ section_of( 'README.md', 'Hitimes')
184
+ end
185
+
186
+ # Internal: Return the summary text from the README
187
+ def summary
188
+ description_section.first
189
+ end
190
+
191
+ # Internal: Return the full description text from the README
192
+ def description
193
+ description_section.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
194
+ end
195
+
196
+ def license
197
+ license_file = project_path("LICENSE")
198
+ line = license_file.readlines.first
199
+ line.split(/\s+/).first
200
+ end
201
+
202
+ # Internal: The path to the gemspec file
203
+ def gemspec_file
204
+ project_path( "#{ name }.gemspec" )
205
+ end
206
+ end
207
+
208
+ This = ThisProject.new
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hitimes
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0
5
+ platform: x64-mingw32
6
+ authors:
7
+ - Jeremy Hinegardner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '12.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '12.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake-compiler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake-compiler-dock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.14'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.14'
111
+ description: "(https://travis-ci.org/copiousfreetime/hitimes.svg?branch=master)](https://travis-ci.org/copiousfreetime/hitimes)
112
+ A fast, high resolution timer library for recording peformance metrics. * (http://github.com/copiousfreetime/hitimes)
113
+ * (http://github.com.org/copiousfreetime/hitimes) * email jeremy at copiousfreetime
114
+ dot org * `git clone url git://github.com/copiousfreetime/hitimes.git`"
115
+ email: jeremy@copiousfreetime.org
116
+ executables: []
117
+ extensions: []
118
+ extra_rdoc_files:
119
+ - CONTRIBUTING.md
120
+ - HISTORY.md
121
+ - Manifest.txt
122
+ - README.md
123
+ files:
124
+ - CONTRIBUTING.md
125
+ - HISTORY.md
126
+ - LICENSE
127
+ - Manifest.txt
128
+ - README.md
129
+ - Rakefile
130
+ - examples/benchmarks.rb
131
+ - examples/stats.rb
132
+ - ext/hitimes/c/extconf.rb
133
+ - ext/hitimes/c/hitimes.c
134
+ - ext/hitimes/c/hitimes_instant_clock_gettime.c
135
+ - ext/hitimes/c/hitimes_instant_osx.c
136
+ - ext/hitimes/c/hitimes_instant_windows.c
137
+ - ext/hitimes/c/hitimes_interval.c
138
+ - ext/hitimes/c/hitimes_interval.h
139
+ - ext/hitimes/c/hitimes_stats.c
140
+ - ext/hitimes/c/hitimes_stats.h
141
+ - ext/hitimes/java/src/hitimes/Hitimes.java
142
+ - ext/hitimes/java/src/hitimes/HitimesInterval.java
143
+ - ext/hitimes/java/src/hitimes/HitimesService.java
144
+ - ext/hitimes/java/src/hitimes/HitimesStats.java
145
+ - lib/hitimes.rb
146
+ - lib/hitimes/2.0/hitimes.so
147
+ - lib/hitimes/2.1/hitimes.so
148
+ - lib/hitimes/2.2/hitimes.so
149
+ - lib/hitimes/2.3/hitimes.so
150
+ - lib/hitimes/2.4/hitimes.so
151
+ - lib/hitimes/2.5/hitimes.so
152
+ - lib/hitimes/metric.rb
153
+ - lib/hitimes/mutexed_stats.rb
154
+ - lib/hitimes/paths.rb
155
+ - lib/hitimes/stats.rb
156
+ - lib/hitimes/timed_metric.rb
157
+ - lib/hitimes/timed_value_metric.rb
158
+ - lib/hitimes/value_metric.rb
159
+ - lib/hitimes/version.rb
160
+ - spec/hitimes_spec.rb
161
+ - spec/interval_spec.rb
162
+ - spec/metric_spec.rb
163
+ - spec/mutex_stats_spec.rb
164
+ - spec/paths_spec.rb
165
+ - spec/spec_helper.rb
166
+ - spec/stats_spec.rb
167
+ - spec/timed_metric_spec.rb
168
+ - spec/timed_value_metric_spec.rb
169
+ - spec/value_metric_spec.rb
170
+ - spec/version_spec.rb
171
+ - tasks/default.rake
172
+ - tasks/extension.rake
173
+ - tasks/this.rb
174
+ homepage: http://github.com/copiousfreetime/hitimes
175
+ licenses:
176
+ - ISC
177
+ metadata: {}
178
+ post_install_message:
179
+ rdoc_options:
180
+ - "--main"
181
+ - README.md
182
+ - "--markup"
183
+ - tomdoc
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '2.0'
191
+ - - "<"
192
+ - !ruby/object:Gem::Version
193
+ version: '2.6'
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ requirements: []
200
+ rubyforge_project:
201
+ rubygems_version: 2.7.3
202
+ signing_key:
203
+ specification_version: 4
204
+ summary: "[![Build Status](https://travis-ci.org/copiousfreetime/hitimes.svg?branch=master)](https://travis-ci.org/copiousfreetime/hitimes)"
205
+ test_files:
206
+ - spec/hitimes_spec.rb
207
+ - spec/interval_spec.rb
208
+ - spec/metric_spec.rb
209
+ - spec/mutex_stats_spec.rb
210
+ - spec/paths_spec.rb
211
+ - spec/spec_helper.rb
212
+ - spec/stats_spec.rb
213
+ - spec/timed_metric_spec.rb
214
+ - spec/timed_value_metric_spec.rb
215
+ - spec/value_metric_spec.rb
216
+ - spec/version_spec.rb