hitimes 1.2.6-x86-mingw32 → 1.3.0-x86-mingw32
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.
- checksums.yaml +5 -5
- data/HISTORY.md +6 -0
- data/README.md +6 -3
- data/ext/hitimes/c/hitimes.c +17 -1
- data/ext/hitimes/java/src/hitimes/Hitimes.java +16 -4
- data/ext/hitimes/java/src/hitimes/HitimesInterval.java +4 -9
- data/ext/hitimes/java/src/hitimes/HitimesService.java +1 -1
- data/lib/hitimes/2.0/hitimes.so +0 -0
- data/lib/hitimes/2.1/hitimes.so +0 -0
- data/lib/hitimes/2.2/hitimes.so +0 -0
- data/lib/hitimes/2.3/hitimes.so +0 -0
- data/lib/hitimes/2.4/hitimes.so +0 -0
- data/lib/hitimes/2.5/hitimes.so +0 -0
- data/lib/hitimes/version.rb +1 -1
- data/spec/hitimes_spec.rb +10 -0
- data/tasks/default.rake +3 -3
- data/tasks/extension.rake +3 -3
- data/tasks/this.rb +3 -1
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dc88d5e0f6472a324291e27dc5fb0dd6686d157e9d0a13bd28b61b9774ab84ec
|
4
|
+
data.tar.gz: 2428d66f48c04b6c7c7ddf50a492d2a3c972560fad1c717f3f53984c82ac9681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc2a3845c1deb1203441cebf93792a7f1b9f3640cfd36cd4387edb6669435ef380551ea0f3644ccc65853a0c3f4e4b35374a3f5792824995c8291bb1866d4122
|
7
|
+
data.tar.gz: 2ab963e8525d018be3e4706d2d94fb655e8ab64206b49bb03c205bee7f2bed7bde1340331ea73ba6f684b8183b948676743cd0c75d65823a7bb2926022183438
|
data/HISTORY.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
# Hitimes Changelog
|
2
|
+
## Version 1.3.0 2018-06-15
|
3
|
+
|
4
|
+
* Add api method `Hitimes.raw_instant` to expose raw OS instant value
|
5
|
+
* Add api constant `Hitimes::INSTANT_CONVERSION_FACTOR` to expose raw OS instant conversion factor
|
6
|
+
* other development cleanup tasks
|
7
|
+
|
2
8
|
## Version 1.2.6 2017-08-04
|
3
9
|
|
4
10
|
* Resolve version number issue (#61) (thanks @anthraxx)
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Hitimes
|
2
2
|
|
3
|
+
[](https://travis-ci.org/copiousfreetime/hitimes)
|
4
|
+
|
3
5
|
A fast, high resolution timer library for recording peformance metrics.
|
4
6
|
|
5
7
|
* [Homepage](http://github.com/copiousfreetime/hitimes)
|
@@ -15,6 +17,7 @@ A fast, high resolution timer library for recording peformance metrics.
|
|
15
17
|
* [Support](#support)
|
16
18
|
* [License](#license)
|
17
19
|
|
20
|
+
|
18
21
|
## Requirements
|
19
22
|
|
20
23
|
Hitimes requires the following to run:
|
@@ -156,14 +159,14 @@ Hitimes also follows [semantic versioning](http://semver.org/).
|
|
156
159
|
|
157
160
|
The current officially supported versions of Ruby are:
|
158
161
|
|
159
|
-
* MRI Ruby (all platforms) 2.
|
160
|
-
* JRuby 1.
|
162
|
+
* MRI Ruby (all platforms) 2.3 - 2.5
|
163
|
+
* JRuby 9.1.17.0, 9.2.0.0
|
161
164
|
|
162
165
|
Unofficially supported versions, these have been supported in the past when they
|
163
166
|
were the primary rubies around. In all likelihood they still work, but are not
|
164
167
|
supported.
|
165
168
|
|
166
|
-
* MRI Ruby (linux/mac/bsd/unix/etc) - everything from 1.8.7 to 2.
|
169
|
+
* MRI Ruby (linux/mac/bsd/unix/etc) - everything from 1.8.7 to 2.2
|
167
170
|
* MRI Ruby (windows) - 2.0 and up
|
168
171
|
* Ruby 1.8 and 1.9 for windows are supported in hitimes version 1.2.4 or earlier
|
169
172
|
* JRuby - I think everything back to 1.4
|
data/ext/hitimes/c/hitimes.c
CHANGED
@@ -5,6 +5,20 @@
|
|
5
5
|
VALUE mH; /* module Hitimes */
|
6
6
|
VALUE eH_Error; /* class Hitimes::Error */
|
7
7
|
|
8
|
+
|
9
|
+
/**
|
10
|
+
* call-seq:
|
11
|
+
* Hitimes.raw_instant -> Integer
|
12
|
+
*
|
13
|
+
* Return the raw instant value from the operating system
|
14
|
+
*/
|
15
|
+
VALUE hitimes_instant_raw( )
|
16
|
+
{
|
17
|
+
unsigned long long i = (unsigned long long)hitimes_get_current_instant( );
|
18
|
+
|
19
|
+
return ULL2NUM(i);
|
20
|
+
}
|
21
|
+
|
8
22
|
/*
|
9
23
|
* Document-class: Hitimes::Error
|
10
24
|
*
|
@@ -13,8 +27,10 @@ VALUE eH_Error; /* class Hitimes::Error */
|
|
13
27
|
void Init_hitimes( )
|
14
28
|
{
|
15
29
|
mH = rb_define_module("Hitimes");
|
16
|
-
|
30
|
+
|
17
31
|
eH_Error = rb_define_class_under(mH, "Error", rb_eStandardError);
|
32
|
+
rb_define_const( mH, "INSTANT_CONVERSION_FACTOR", DBL2NUM( HITIMES_INSTANT_CONVERSION_FACTOR ));
|
33
|
+
rb_define_module_function( mH, "raw_instant", hitimes_instant_raw, 0 );
|
18
34
|
|
19
35
|
Init_hitimes_interval();
|
20
36
|
Init_hitimes_stats( );
|
@@ -4,7 +4,10 @@ import java.lang.Math;
|
|
4
4
|
import java.lang.System;
|
5
5
|
|
6
6
|
import org.jruby.anno.JRubyClass;
|
7
|
+
import org.jruby.anno.JRubyMethod;
|
7
8
|
import org.jruby.anno.JRubyModule;
|
9
|
+
import org.jruby.anno.JRubyConstant;
|
10
|
+
import org.jruby.runtime.Visibility;
|
8
11
|
|
9
12
|
import org.jruby.Ruby;
|
10
13
|
import org.jruby.RubyClass;
|
@@ -14,6 +17,8 @@ import org.jruby.RubyObject;
|
|
14
17
|
|
15
18
|
import org.jruby.exceptions.RaiseException;
|
16
19
|
|
20
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
21
|
+
|
17
22
|
|
18
23
|
/**
|
19
24
|
* @author <a href="mailto:jeremy@hinegardner.org">Jeremy Hinegardner</a>
|
@@ -21,12 +26,18 @@ import org.jruby.exceptions.RaiseException;
|
|
21
26
|
@JRubyModule( name = "Hitimes" )
|
22
27
|
public class Hitimes {
|
23
28
|
|
29
|
+
public static final double INSTANT_CONVERSION_FACTOR = 1000000000d;
|
30
|
+
|
31
|
+
private static final Ruby __ruby__ = Ruby.getGlobalRuntime();
|
32
|
+
|
24
33
|
public static RubyClass hitimesIntervalClass;
|
25
34
|
/**
|
26
35
|
* Create the Hitimes module and add it to the Ruby runtime.
|
27
36
|
*/
|
28
|
-
public static RubyModule
|
37
|
+
public static RubyModule createHitimesModule( Ruby runtime ) {
|
29
38
|
RubyModule mHitimes = runtime.defineModule("Hitimes");
|
39
|
+
mHitimes.defineConstant("INSTANT_CONVERSION_FACTOR", __ruby__.newFloat(INSTANT_CONVERSION_FACTOR));
|
40
|
+
mHitimes.defineAnnotatedMethods( Hitimes.class );
|
30
41
|
|
31
42
|
RubyClass cStandardError = runtime.getStandardError();
|
32
43
|
RubyClass cHitimesError = mHitimes.defineClassUnder("Error", cStandardError, cStandardError.getAllocator());
|
@@ -47,8 +58,9 @@ public class Hitimes {
|
|
47
58
|
}
|
48
59
|
|
49
60
|
|
50
|
-
|
51
|
-
|
52
|
-
|
61
|
+
@JRubyMethod( name = "raw_instant", module = true )
|
62
|
+
public static IRubyObject rawInstant(IRubyObject self) {
|
63
|
+
return __ruby__.newFixnum( System.nanoTime() );
|
64
|
+
}
|
53
65
|
|
54
66
|
}
|
@@ -16,11 +16,6 @@ import org.jruby.anno.JRubyMethod;
|
|
16
16
|
@JRubyClass( name = "Hitimes::Interval" )
|
17
17
|
public class HitimesInterval extends RubyObject {
|
18
18
|
|
19
|
-
/* this is a double to force all division by the conversion factor
|
20
|
-
* to cast to doubles
|
21
|
-
*/
|
22
|
-
private static final double INSTANT_CONVERSION_FACTOR = 1000000000d;
|
23
|
-
|
24
19
|
private static final long INSTANT_NOT_SET = Long.MIN_VALUE;
|
25
20
|
private static final double DURATION_NOT_SET = Double.NaN;
|
26
21
|
|
@@ -58,7 +53,7 @@ public class HitimesInterval extends RubyObject {
|
|
58
53
|
* if stop has not yet been called, then return the amount of time so far
|
59
54
|
*/
|
60
55
|
if ( INSTANT_NOT_SET == this.stop_instant ) {
|
61
|
-
double d = ( System.nanoTime() - this.start_instant ) / INSTANT_CONVERSION_FACTOR;
|
56
|
+
double d = ( System.nanoTime() - this.start_instant ) / Hitimes.INSTANT_CONVERSION_FACTOR;
|
62
57
|
return getRuntime().newFloat( d );
|
63
58
|
}
|
64
59
|
|
@@ -66,7 +61,7 @@ public class HitimesInterval extends RubyObject {
|
|
66
61
|
* if stop has been called, then calculate the duration and return
|
67
62
|
*/
|
68
63
|
if ( DURATION_NOT_SET == this.duration ) {
|
69
|
-
this.duration = (this.stop_instant - this.start_instant) / INSTANT_CONVERSION_FACTOR;
|
64
|
+
this.duration = (this.stop_instant - this.start_instant) / Hitimes.INSTANT_CONVERSION_FACTOR;
|
70
65
|
}
|
71
66
|
|
72
67
|
return getRuntime().newFloat( this.duration );
|
@@ -82,7 +77,7 @@ public class HitimesInterval extends RubyObject {
|
|
82
77
|
}
|
83
78
|
|
84
79
|
if ( INSTANT_NOT_SET == this.stop_instant ) {
|
85
|
-
double d = ( System.nanoTime() - this.start_instant ) / INSTANT_CONVERSION_FACTOR;
|
80
|
+
double d = ( System.nanoTime() - this.start_instant ) / Hitimes.INSTANT_CONVERSION_FACTOR;
|
86
81
|
return getRuntime().newFloat( d );
|
87
82
|
}
|
88
83
|
|
@@ -140,7 +135,7 @@ public class HitimesInterval extends RubyObject {
|
|
140
135
|
|
141
136
|
if ( INSTANT_NOT_SET == this.stop_instant ) {
|
142
137
|
this.stop_instant = System.nanoTime();
|
143
|
-
this.duration = (this.stop_instant - this.start_instant) / INSTANT_CONVERSION_FACTOR;
|
138
|
+
this.duration = (this.stop_instant - this.start_instant) / Hitimes.INSTANT_CONVERSION_FACTOR;
|
144
139
|
return getRuntime().newFloat( this.duration );
|
145
140
|
}
|
146
141
|
|
@@ -8,7 +8,7 @@ import org.jruby.runtime.load.BasicLibraryService;
|
|
8
8
|
|
9
9
|
public class HitimesService implements BasicLibraryService {
|
10
10
|
public boolean basicLoad( final Ruby runtime ) throws IOException {
|
11
|
-
Hitimes.
|
11
|
+
Hitimes.createHitimesModule( runtime );
|
12
12
|
return true;
|
13
13
|
}
|
14
14
|
}
|
data/lib/hitimes/2.0/hitimes.so
CHANGED
Binary file
|
data/lib/hitimes/2.1/hitimes.so
CHANGED
Binary file
|
data/lib/hitimes/2.2/hitimes.so
CHANGED
Binary file
|
data/lib/hitimes/2.3/hitimes.so
CHANGED
Binary file
|
data/lib/hitimes/2.4/hitimes.so
CHANGED
Binary file
|
Binary file
|
data/lib/hitimes/version.rb
CHANGED
data/spec/hitimes_spec.rb
CHANGED
@@ -11,4 +11,14 @@ describe Hitimes do
|
|
11
11
|
it "raises an error if measure is called with no block" do
|
12
12
|
lambda{ Hitimes.measure }.must_raise( Hitimes::Error )
|
13
13
|
end
|
14
|
+
|
15
|
+
it "has the raw instant value" do
|
16
|
+
v = Hitimes.raw_instant
|
17
|
+
v.must_be :>, 0
|
18
|
+
end
|
19
|
+
|
20
|
+
it "has access to the instant conversion factor" do
|
21
|
+
f = Hitimes::INSTANT_CONVERSION_FACTOR
|
22
|
+
f.must_be :>, 0
|
23
|
+
end
|
14
24
|
end
|
data/tasks/default.rake
CHANGED
@@ -24,7 +24,7 @@ namespace :develop do
|
|
24
24
|
File.open( "Gemfile", "w+" ) do |f|
|
25
25
|
f.puts "# DO NOT EDIT - This file is automatically generated"
|
26
26
|
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
27
|
-
f.puts 'source "https://rubygems.org
|
27
|
+
f.puts 'source "https://rubygems.org"'
|
28
28
|
f.puts 'gemspec'
|
29
29
|
end
|
30
30
|
end
|
@@ -38,7 +38,7 @@ task :develop => "develop:default"
|
|
38
38
|
begin
|
39
39
|
require 'rake/testtask'
|
40
40
|
Rake::TestTask.new( :test ) do |t|
|
41
|
-
t.ruby_opts = %w[ -w
|
41
|
+
t.ruby_opts = %w[ -w ]
|
42
42
|
t.libs = %w[ lib spec test ]
|
43
43
|
t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
|
44
44
|
end
|
@@ -80,7 +80,7 @@ begin
|
|
80
80
|
ENV['COVERAGE'] = 'true'
|
81
81
|
Rake::Task[:test].execute
|
82
82
|
end
|
83
|
-
CLOBBER << 'coverage' if File.directory?('coverage')
|
83
|
+
CLOBBER << 'coverage' if File.directory?( 'coverage' )
|
84
84
|
rescue LoadError
|
85
85
|
This.task_warning( 'simplecov' )
|
86
86
|
end
|
data/tasks/extension.rake
CHANGED
@@ -23,9 +23,9 @@ begin
|
|
23
23
|
ext.lib_dir = File.join( 'lib', This.name )
|
24
24
|
ext.gem_spec = This.ruby_gemspec
|
25
25
|
|
26
|
-
ext.cross_compile = true
|
27
|
-
ext.cross_platform =
|
28
|
-
|
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
29
|
end
|
30
30
|
end
|
31
31
|
|
data/tasks/this.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hitimes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Jeremy Hinegardner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -108,9 +108,10 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.14'
|
111
|
-
description:
|
112
|
-
|
113
|
-
*
|
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`"
|
114
115
|
email: jeremy@copiousfreetime.org
|
115
116
|
executables: []
|
116
117
|
extensions: []
|
@@ -147,6 +148,7 @@ files:
|
|
147
148
|
- lib/hitimes/2.2/hitimes.so
|
148
149
|
- lib/hitimes/2.3/hitimes.so
|
149
150
|
- lib/hitimes/2.4/hitimes.so
|
151
|
+
- lib/hitimes/2.5/hitimes.so
|
150
152
|
- lib/hitimes/metric.rb
|
151
153
|
- lib/hitimes/mutexed_stats.rb
|
152
154
|
- lib/hitimes/paths.rb
|
@@ -188,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
190
|
version: '2.0'
|
189
191
|
- - "<"
|
190
192
|
- !ruby/object:Gem::Version
|
191
|
-
version: '2.
|
193
|
+
version: '2.6'
|
192
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
195
|
requirements:
|
194
196
|
- - ">="
|
@@ -196,10 +198,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
198
|
version: '0'
|
197
199
|
requirements: []
|
198
200
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.7.3
|
200
202
|
signing_key:
|
201
203
|
specification_version: 4
|
202
|
-
summary:
|
204
|
+
summary: "[](https://travis-ci.org/copiousfreetime/hitimes)"
|
203
205
|
test_files:
|
204
206
|
- spec/hitimes_spec.rb
|
205
207
|
- spec/interval_spec.rb
|