hitimes 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{HISTORY.rdoc → HISTORY.md} +25 -19
- data/Manifest.txt +2 -2
- data/README.md +163 -0
- data/Rakefile +4 -4
- data/lib/hitimes/version.rb +1 -1
- data/tasks/default.rake +6 -2
- data/tasks/extension.rake +1 -1
- data/tasks/this.rb +4 -4
- metadata +25 -37
- data/README.rdoc +0 -148
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 736be6cc3cde6ee7776bbf9a7323cd87a1ec377f
|
4
|
+
data.tar.gz: 5e66a98e60f51d7a1651dd8112e4e660f0aa15f8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aece4200d9b9186b1b9eb9bf2be09925dd7bbb535a7c3464e23d4dcd01c0a20de393aa75323c5f38f6ed77fe2109d83fee6f389b38810b21adc48e66318c6143
|
7
|
+
data.tar.gz: 9143293beee4a4d4b904f751a28617b69e280abe8d7446868a75e4d329c4c3458aecba417dab89cbf4e3f9a3fb21d9a8156057a980b20dacb0bc09ef8c2ad615
|
data/{HISTORY.rdoc → HISTORY.md}
RENAMED
@@ -1,6 +1,12 @@
|
|
1
|
-
|
1
|
+
# Hitimes Changelog
|
2
2
|
|
3
|
-
|
3
|
+
## Version 1.2.1 2013-03-12
|
4
|
+
|
5
|
+
* Update dependencies
|
6
|
+
* Ruby 2.0 fixes
|
7
|
+
* Switch to Markdown, Yeah RDoc 4.0!
|
8
|
+
|
9
|
+
## Version 1.2.0 2013-02-09
|
4
10
|
|
5
11
|
* Update dependencies
|
6
12
|
* Documentation cleanup
|
@@ -12,75 +18,75 @@
|
|
12
18
|
* Added Hitimes.measure
|
13
19
|
* Switch to using rake-compiler for cross compilation of gems
|
14
20
|
|
15
|
-
|
21
|
+
## Version 1.1.1 2010-09-04
|
16
22
|
|
17
23
|
* Remove the unnecessary dependencies that should be development dependencies
|
18
24
|
|
19
|
-
|
25
|
+
## Version 1.1.0 2010-07-28
|
20
26
|
|
21
27
|
* Add a pure java extension so hitimes may be used in jruby with the same API
|
22
28
|
|
23
|
-
|
29
|
+
## Version 1.0.5 2010-07-20
|
24
30
|
|
25
31
|
* Fix 'circular require considered harmful' warnings in 1.9.x (reported by Roger Pack)
|
26
32
|
* Fix 'method redefined' warnings in 1.9.x (reported by Roger Pack)
|
27
33
|
|
28
|
-
|
34
|
+
## Version 1.0.4 2009-08-01
|
29
35
|
|
30
36
|
* Add in support for x86-mingw32 gem
|
31
37
|
* Add version subdirectory for extension on all platforms
|
32
38
|
|
33
|
-
|
39
|
+
## Version 1.0.3 2009-06-28
|
34
40
|
|
35
41
|
* Fix bug with time.h on linode (reported by Roger Pack)
|
36
42
|
* Fix potential garbage collection issue with Interval class
|
37
43
|
* Windows gem is now a fat binary to support installing in 1.8 or 1.9 from the
|
38
44
|
same gem
|
39
45
|
|
40
|
-
|
46
|
+
## Version 1.0.1 2009-06-12
|
41
47
|
|
42
48
|
* Fix examples
|
43
49
|
* performance tuning, new Hitimes::Metric derived classes are faster than old Timer class
|
44
50
|
|
45
|
-
|
51
|
+
## Version 1.0.0 2009-06-12
|
46
52
|
|
47
53
|
* Major version bump with complete refactor of the metric collection API
|
48
54
|
* 3 types of metrics now instead of just 1 Timer
|
49
|
-
|
50
|
-
|
51
|
-
|
55
|
+
* Hitimes::ValueMetric
|
56
|
+
* Hitimes::TimedMetric
|
57
|
+
* Hitimes::TimedValueMetric
|
52
58
|
* The ability to convert all metrics #to_hash
|
53
59
|
* Updated documentation with examples using each metric type
|
54
60
|
|
55
|
-
|
61
|
+
## Version 0.4.1 2009-02-19
|
56
62
|
|
57
63
|
* change to ISC License
|
58
64
|
* fix bug in compilation on gentoo
|
59
65
|
|
60
|
-
|
66
|
+
## Version 0.4.0 2008-12-20
|
61
67
|
|
62
68
|
* Added new stat 'rate'
|
63
69
|
* Added new stat method to_hash
|
64
70
|
* Added Hitimes::MutexedStats class for threadsafe stats collection
|
65
|
-
|
71
|
+
- not needed when used in MRI 1.8.x
|
66
72
|
* remove stale dependency on mkrf
|
67
73
|
|
68
|
-
|
74
|
+
## Version 0.3.0
|
69
75
|
|
70
76
|
* switched to extconf for building extensions
|
71
77
|
* first release of windows binary gem
|
72
78
|
* reverted back to normal rdoc
|
73
79
|
|
74
|
-
|
80
|
+
## Version 0.2.1
|
75
81
|
|
76
82
|
* added Timer#rate method
|
77
83
|
* switched to darkfish rdoc
|
78
84
|
|
79
|
-
|
85
|
+
## Version 0.2.0
|
80
86
|
|
81
87
|
* Performance improvements
|
82
88
|
* Added Hitimes::Stats class
|
83
89
|
|
84
|
-
|
90
|
+
## Version 0.1.0
|
85
91
|
|
86
92
|
* Initial completion
|
data/Manifest.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
## hitimes
|
2
|
+
|
3
|
+
* [Homepage](http://github.com/copiousfreetime/hitimes)
|
4
|
+
* [Github project](http://github.com.org/copiousfreetime/hitimes)
|
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 low 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 `clock_gettime()`
|
21
|
+
* Mac OS X
|
22
|
+
* Windows
|
23
|
+
* JRuby
|
24
|
+
|
25
|
+
Using Hitimes can be faster than using a series of `Time.new` calls, and
|
26
|
+
it will have a much higher granularity. It is definitely faster than
|
27
|
+
using `Process.times`.
|
28
|
+
|
29
|
+
## SYNOPSIS
|
30
|
+
|
31
|
+
### Interval
|
32
|
+
|
33
|
+
Use Hitimes::Interval to calculate only the duration of a block of code
|
34
|
+
|
35
|
+
``` ruby
|
36
|
+
duration = Hitimes::Interval.measure do
|
37
|
+
# some operation ...
|
38
|
+
end
|
39
|
+
|
40
|
+
puts duration
|
41
|
+
```
|
42
|
+
|
43
|
+
### TimedMetric
|
44
|
+
|
45
|
+
Use a Hitimes::TimedMetric to calculate statistics about an iterative operation
|
46
|
+
|
47
|
+
``` ruby
|
48
|
+
timed_metric = Hitimes::TimedMetric.new('operation on items')
|
49
|
+
```
|
50
|
+
|
51
|
+
Explicitly use `start` and `stop`:
|
52
|
+
|
53
|
+
``` ruby
|
54
|
+
collection.each do |item|
|
55
|
+
timed_metric.start
|
56
|
+
# .. do something with item
|
57
|
+
timed_metric.stop
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
Or use the block. In TimedMetric the return value of +measure+ is the return
|
62
|
+
value of the block
|
63
|
+
|
64
|
+
``` ruby
|
65
|
+
collection.each do |item|
|
66
|
+
result_of_do_something = timed_metric.measure { do_something( item ) }
|
67
|
+
end
|
68
|
+
```
|
69
|
+
And then look at the stats
|
70
|
+
|
71
|
+
``` ruby
|
72
|
+
puts timed_metric.mean
|
73
|
+
puts timed_metric.max
|
74
|
+
puts timed_metric.min
|
75
|
+
puts timed_metric.stddev
|
76
|
+
puts timed_metric.rate
|
77
|
+
```
|
78
|
+
### ValueMetric
|
79
|
+
|
80
|
+
Use a Hitimes::ValueMetric to calculate statistics about measured samples
|
81
|
+
|
82
|
+
``` ruby
|
83
|
+
value_metric = Hitimes::ValueMetric.new( 'size of thing' )
|
84
|
+
loop do
|
85
|
+
# ... do stuff changing sizes of 'thing'
|
86
|
+
value_metric.measure( thing.size )
|
87
|
+
# ... do other stuff that may change size of thing
|
88
|
+
end
|
89
|
+
|
90
|
+
puts value_metric.mean
|
91
|
+
puts value_metric.max
|
92
|
+
puts value_metric.min
|
93
|
+
puts value_metric.stddev
|
94
|
+
puts value_metric.rate
|
95
|
+
```
|
96
|
+
|
97
|
+
### TimedValueMetric
|
98
|
+
|
99
|
+
Use a Hitimes::TimedValueMetric to calculate statistics about batches of samples
|
100
|
+
|
101
|
+
``` ruby
|
102
|
+
timed_value_metric = Hitimes::TimedValueMetric.new( 'batch times' )
|
103
|
+
loop do
|
104
|
+
batch = ... # get a batch of things
|
105
|
+
timed_value_metric.start
|
106
|
+
# .. do something with batch
|
107
|
+
timed_value_metric.stop( batch.size )
|
108
|
+
end
|
109
|
+
|
110
|
+
puts timed_value_metric.rate
|
111
|
+
|
112
|
+
puts timed_value_metric.timed_stats.mean
|
113
|
+
puts timed_value_metric.timed_stats.max
|
114
|
+
puts timed_value_metric.timed_stats.min
|
115
|
+
puts timed_value_metric.timed_stats.stddev
|
116
|
+
|
117
|
+
puts timed_value_metric.value_stats.mean
|
118
|
+
puts timed_value_metric.value_stats.max
|
119
|
+
puts timed_value_metric.value_stats.min
|
120
|
+
puts timed_value_metric.value_stats.stddev
|
121
|
+
```
|
122
|
+
|
123
|
+
## CHANGES
|
124
|
+
|
125
|
+
Read the HISTORY.md file.
|
126
|
+
|
127
|
+
## BUILDING FOR WINDOWS
|
128
|
+
|
129
|
+
[rake-compiler](https://github.com/luislavena/rake-compiler) is use for building
|
130
|
+
the windows version. For me, on OSX to cross compile the process is:
|
131
|
+
|
132
|
+
```
|
133
|
+
% gem install rake-compiler # in each rvm instance, 1.8.7, 1.9.3
|
134
|
+
% rvm use 2.0.0@hitimes
|
135
|
+
% rake-compiler cross-ruby VERSION=2.0.0-p0 # or latest
|
136
|
+
% rvm use 1.9.3@hitimes
|
137
|
+
% rake-compiler cross-ruby VERSION=1.9.3-p374 # or latest
|
138
|
+
% rvm use 1.8.7@hitimes
|
139
|
+
% rake-compiler cross-ruby VERSION=1.8.7-p371
|
140
|
+
|
141
|
+
# This only works via 1.8.7 at the current moment
|
142
|
+
% rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0
|
143
|
+
```
|
144
|
+
|
145
|
+
## CREDITS
|
146
|
+
|
147
|
+
* [Bruce Williams](https://github.com/bruce) for suggesting the idea
|
148
|
+
|
149
|
+
## ISC License
|
150
|
+
|
151
|
+
Copyright (c) 2008-2012 Jeremy Hinegardner
|
152
|
+
|
153
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
154
|
+
purpose with or without fee is hereby granted, provided that the above
|
155
|
+
copyright notice and this permission notice appear in all copies.
|
156
|
+
|
157
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
158
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
159
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
160
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
161
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
162
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
163
|
+
PERFORMANCE OF THIS SOFTWARE.
|
data/Rakefile
CHANGED
@@ -8,10 +8,10 @@ This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
|
8
8
|
|
9
9
|
This.ruby_gemspec do |spec|
|
10
10
|
spec.add_development_dependency( 'rake' , '~> 10.0.3')
|
11
|
-
spec.add_development_dependency( 'rspec' , '~> 2.
|
12
|
-
spec.add_development_dependency( 'rdoc' , '~>
|
13
|
-
spec.add_development_dependency( 'json' , '~> 1.7.
|
14
|
-
spec.add_development_dependency( 'rake-compiler', '~> 0.8.
|
11
|
+
spec.add_development_dependency( 'rspec' , '~> 2.13.0' )
|
12
|
+
spec.add_development_dependency( 'rdoc' , '~> 4.0' )
|
13
|
+
spec.add_development_dependency( 'json' , '~> 1.7.7' )
|
14
|
+
spec.add_development_dependency( 'rake-compiler', '~> 0.8.3' )
|
15
15
|
|
16
16
|
spec.extensions.concat This.extension_conf_files
|
17
17
|
end
|
data/lib/hitimes/version.rb
CHANGED
data/tasks/default.rake
CHANGED
@@ -74,9 +74,10 @@ begin
|
|
74
74
|
RDoc::Task.new do |t|
|
75
75
|
t.markup = 'tomdoc'
|
76
76
|
t.rdoc_dir = 'doc'
|
77
|
-
t.main = 'README.
|
77
|
+
t.main = 'README.md'
|
78
78
|
t.title = "#{This.name} #{This.version}"
|
79
|
-
t.rdoc_files.include( '*.rdoc', '
|
79
|
+
t.rdoc_files.include( FileList['*.{rdoc,md,txt}'], FileList['ext/**/*.c'],
|
80
|
+
FileList['lib/**/*.rb'] )
|
80
81
|
end
|
81
82
|
rescue LoadError => le
|
82
83
|
This.task_warning( 'rdoc' )
|
@@ -228,6 +229,9 @@ end
|
|
228
229
|
# the gemspec is also a dev artifact and should not be kept around.
|
229
230
|
CLOBBER << This.gemspec_file.to_s
|
230
231
|
|
232
|
+
# .rbc files from ruby 2.0
|
233
|
+
CLOBBER << FileList["**/*.rbc"]
|
234
|
+
|
231
235
|
# The standard gem packaging task, everyone has it.
|
232
236
|
require 'rubygems/package_task'
|
233
237
|
Gem::PackageTask.new( This.platform_gemspec ) do
|
data/tasks/extension.rake
CHANGED
data/tasks/this.rb
CHANGED
@@ -54,7 +54,7 @@ class ThisProject
|
|
54
54
|
#
|
55
55
|
# Retuns the text of the section as an array of paragrphs.
|
56
56
|
def section_of( file, section_name )
|
57
|
-
re =
|
57
|
+
re = /^[=#]+ (.*)$/
|
58
58
|
sectional = project_path( file )
|
59
59
|
parts = sectional.read.split( re )[1..-1]
|
60
60
|
parts.map! { |p| p.strip }
|
@@ -137,8 +137,8 @@ class ThisProject
|
|
137
137
|
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
138
138
|
spec.test_files = spec.files.grep(/^spec/)
|
139
139
|
|
140
|
-
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc)$/)
|
141
|
-
spec.rdoc_options = [ "--main" , 'README.
|
140
|
+
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc|md)$/)
|
141
|
+
spec.rdoc_options = [ "--main" , 'README.md',
|
142
142
|
"--markup", "tomdoc" ]
|
143
143
|
end
|
144
144
|
end
|
@@ -187,7 +187,7 @@ class ThisProject
|
|
187
187
|
|
188
188
|
# Internal: Return the DESCRIPTION section of the README.rdoc file
|
189
189
|
def description_section
|
190
|
-
section_of( 'README.
|
190
|
+
section_of( 'README.md', 'DESCRIPTION')
|
191
191
|
end
|
192
192
|
|
193
193
|
# Internal: Return the summary text from the README
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hitimes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeremy Hinegardner
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,88 +27,80 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 2.
|
33
|
+
version: 2.13.0
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.
|
40
|
+
version: 2.13.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rdoc
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
47
|
+
version: '4.0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
54
|
+
version: '4.0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: json
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.7.
|
61
|
+
version: 1.7.7
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.7.
|
68
|
+
version: 1.7.7
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rake-compiler
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.8.
|
75
|
+
version: 0.8.3
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.8.
|
94
|
-
description:
|
82
|
+
version: 0.8.3
|
83
|
+
description: 'Hitimes is a fast, high resolution timer library for recording performance
|
95
84
|
metrics. It uses the appropriate low method calls for each system to get the highest
|
96
85
|
granularity time increments possible. It currently supports any of the following
|
97
|
-
systems: * any system with the POSIX call
|
98
|
-
|
99
|
-
|
100
|
-
+Process.times+.'
|
86
|
+
systems: * any system with the POSIX call `clock_gettime()` * Mac OS X * Windows
|
87
|
+
* JRuby Using Hitimes can be faster than using a series of `Time.new` calls, and
|
88
|
+
it will have a much higher granularity. It is definitely faster than using `Process.times`.'
|
101
89
|
email: jeremy@copiousfreetime.org
|
102
90
|
executables: []
|
103
91
|
extensions:
|
104
92
|
- ext/hitimes/c/extconf.rb
|
105
93
|
extra_rdoc_files:
|
106
|
-
-
|
94
|
+
- CONTRIBUTING.md
|
95
|
+
- HISTORY.md
|
107
96
|
- Manifest.txt
|
108
|
-
- README.
|
97
|
+
- README.md
|
109
98
|
files:
|
110
99
|
- CONTRIBUTING.md
|
111
|
-
- HISTORY.
|
100
|
+
- HISTORY.md
|
112
101
|
- LICENSE
|
113
102
|
- Manifest.txt
|
114
|
-
- README.
|
103
|
+
- README.md
|
115
104
|
- Rakefile
|
116
105
|
- examples/benchmarks.rb
|
117
106
|
- examples/stats.rb
|
@@ -153,31 +142,30 @@ files:
|
|
153
142
|
- tasks/this.rb
|
154
143
|
homepage: http://github.com/copiousfreetime/hitimes
|
155
144
|
licenses: []
|
145
|
+
metadata: {}
|
156
146
|
post_install_message:
|
157
147
|
rdoc_options:
|
158
148
|
- --main
|
159
|
-
- README.
|
149
|
+
- README.md
|
160
150
|
- --markup
|
161
151
|
- tomdoc
|
162
152
|
require_paths:
|
163
153
|
- lib
|
164
154
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
155
|
requirements:
|
167
|
-
- -
|
156
|
+
- - '>='
|
168
157
|
- !ruby/object:Gem::Version
|
169
158
|
version: '0'
|
170
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
-
none: false
|
172
160
|
requirements:
|
173
|
-
- -
|
161
|
+
- - '>='
|
174
162
|
- !ruby/object:Gem::Version
|
175
163
|
version: '0'
|
176
164
|
requirements: []
|
177
165
|
rubyforge_project:
|
178
|
-
rubygems_version:
|
166
|
+
rubygems_version: 2.0.3
|
179
167
|
signing_key:
|
180
|
-
specification_version:
|
168
|
+
specification_version: 4
|
181
169
|
summary: Hitimes is a fast, high resolution timer library for recording performance
|
182
170
|
metrics. It uses the appropriate low method calls for each system to get the highest
|
183
171
|
granularity time increments possible.
|
data/README.rdoc
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
== hitimes
|
2
|
-
|
3
|
-
* Homepage[http://github.com/copiousfreetime/hitimes]
|
4
|
-
* {Github project}[http://github.com.org/copiousfreetime/hitimes]
|
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 low 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
|
-
* JRuby
|
24
|
-
|
25
|
-
Using Hitimes can be faster than using a series of +Time.new+ calls, and
|
26
|
-
it will have a much higher granularity. It is definitely faster than
|
27
|
-
using +Process.times+.
|
28
|
-
|
29
|
-
== SYNOPSIS
|
30
|
-
|
31
|
-
=== Interval
|
32
|
-
|
33
|
-
Use Hitimes::Interval to calculate only the duration of a block of code
|
34
|
-
|
35
|
-
duration = Hitimes::Interval.measure do
|
36
|
-
# some operation ...
|
37
|
-
end
|
38
|
-
|
39
|
-
puts duration
|
40
|
-
|
41
|
-
=== TimedMetric
|
42
|
-
|
43
|
-
Use a Hitimes::TimedMetric to calculate statistics about an iterative operation
|
44
|
-
|
45
|
-
timed_metric = Hitimes::TimedMetric.new('operation on items')
|
46
|
-
|
47
|
-
Explicitly use +start+ and +stop+:
|
48
|
-
|
49
|
-
collection.each do |item|
|
50
|
-
timed_metric.start
|
51
|
-
# .. do something with item
|
52
|
-
timed_metric.stop
|
53
|
-
end
|
54
|
-
|
55
|
-
Or use the block. In TimedMetric the return value of +measure+ is the return
|
56
|
-
value of the block
|
57
|
-
|
58
|
-
collection.each do |item|
|
59
|
-
result_of_do_something = timed_metric.measure { do_something( item ) }
|
60
|
-
end
|
61
|
-
|
62
|
-
And then look at the stats
|
63
|
-
|
64
|
-
puts timed_metric.mean
|
65
|
-
puts timed_metric.max
|
66
|
-
puts timed_metric.min
|
67
|
-
puts timed_metric.stddev
|
68
|
-
puts timed_metric.rate
|
69
|
-
|
70
|
-
=== ValueMetric
|
71
|
-
|
72
|
-
Use a Hitimes::ValueMetric to calculate statistics about measured samples
|
73
|
-
|
74
|
-
value_metric = Hitimes::ValueMetric.new( 'size of thing' )
|
75
|
-
loop do
|
76
|
-
# ... do stuff changing sizes of 'thing'
|
77
|
-
value_metric.measure( thing.size )
|
78
|
-
# ... do other stuff that may change size of thing
|
79
|
-
end
|
80
|
-
|
81
|
-
puts value_metric.mean
|
82
|
-
puts value_metric.max
|
83
|
-
puts value_metric.min
|
84
|
-
puts value_metric.stddev
|
85
|
-
puts value_metric.rate
|
86
|
-
|
87
|
-
|
88
|
-
=== TimedValueMetric
|
89
|
-
|
90
|
-
Use a Hitimes::TimedValueMetric to calculate statistics about batches of samples
|
91
|
-
|
92
|
-
timed_value_metric = Hitimes::TimedValueMetric.new( 'batch times' )
|
93
|
-
loop do
|
94
|
-
batch = ... # get a batch of things
|
95
|
-
timed_value_metric.start
|
96
|
-
# .. do something with batch
|
97
|
-
timed_value_metric.stop( batch.size )
|
98
|
-
end
|
99
|
-
|
100
|
-
puts timed_value_metric.rate
|
101
|
-
|
102
|
-
puts timed_value_metric.timed_stats.mean
|
103
|
-
puts timed_value_metric.timed_stats.max
|
104
|
-
puts timed_value_metric.timed_stats.min
|
105
|
-
puts timed_value_metric.timed_stats.stddev
|
106
|
-
|
107
|
-
puts timed_value_metric.value_stats.mean
|
108
|
-
puts timed_value_metric.value_stats.max
|
109
|
-
puts timed_value_metric.value_stats.min
|
110
|
-
puts timed_value_metric.value_stats.stddev
|
111
|
-
|
112
|
-
|
113
|
-
== CHANGES
|
114
|
-
|
115
|
-
Read the HISTORY file.
|
116
|
-
|
117
|
-
== BUILDING FOR WINDOWS
|
118
|
-
|
119
|
-
{rake-compiler}(https://github.com/luislavena/rake-compiler) is use for building
|
120
|
-
the windows version. For me, on OSX to cross compile the process is:
|
121
|
-
|
122
|
-
% gem install rake-compiler # in each rvm instance, 1.8.7, 1.9.3
|
123
|
-
% rvm use 1.9.3@hitimes
|
124
|
-
% rake-compiler cross-ruby VERSION=1.9.3-p374 # or latest
|
125
|
-
% rvm use 1.8.7@hitimes
|
126
|
-
% rake-compiler cross-ruby VERSION=1.8.7-p371
|
127
|
-
|
128
|
-
# This only works via 1.8.7 at the current moment
|
129
|
-
% rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3
|
130
|
-
== CREDITS
|
131
|
-
|
132
|
-
* Bruce Williams for suggesting the idea
|
133
|
-
|
134
|
-
== ISC License
|
135
|
-
|
136
|
-
Copyright (c) 2008-2012 Jeremy Hinegardner
|
137
|
-
|
138
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
139
|
-
purpose with or without fee is hereby granted, provided that the above
|
140
|
-
copyright notice and this permission notice appear in all copies.
|
141
|
-
|
142
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
143
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
144
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
145
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
146
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
147
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
148
|
-
PERFORMANCE OF THIS SOFTWARE.
|