PAPI 0.101 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/PAPI.gemspec +4 -4
- data/lib/PAPI.rb +1 -0
- data/lib/PAPI/EventSet.rb +1 -1
- data/lib/PAPI/Thread.rb +38 -0
- data/lib/PAPI/Version.rb +4 -16
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b38abf3baa30222434638a5b1af0cba8f664c47
|
4
|
+
data.tar.gz: '079eda46c077084117750f9815221c32c5dcf9b4'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 953f9b8ec70eff81cea4ccf5b7acb1d79ce79371d9c7f7af41fc7a4507dcefa6b3590fe8dda3589a4cee6b7aeb6e1b0dec1dc49d134c4f89363ace64f277562c
|
7
|
+
data.tar.gz: 31499b71710ba897b09c45fe8f6a852bebc80ede2b1b9ccfd8a65903eec7482568e90af9a1679a39e1d068cb613e00933c6f9118ef2522457567adf7edce0dff
|
data/PAPI.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'PAPI'
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "1.0.0"
|
4
4
|
s.author = "Brice Videau"
|
5
5
|
s.email = "brice.videau@imag.fr"
|
6
6
|
s.homepage = "https://github.com/Nanosim-LIG/papi-ruby"
|
7
7
|
s.summary = "Ruby PAPI bindings"
|
8
8
|
s.description = "Ruby PAPI bindings."
|
9
|
-
s.files = %w( PAPI.gemspec LICENSE lib/PAPI.rb lib/PAPI/ lib/PAPI/Version.rb lib/PAPI/Error.rb lib/PAPI/Event.rb lib/PAPI/Component.rb lib/PAPI/EventSet.rb )
|
9
|
+
s.files = %w( PAPI.gemspec LICENSE lib/PAPI.rb lib/PAPI/ lib/PAPI/Version.rb lib/PAPI/Error.rb lib/PAPI/Thread.rb lib/PAPI/Event.rb lib/PAPI/Component.rb lib/PAPI/EventSet.rb )
|
10
10
|
s.has_rdoc = true
|
11
|
-
s.license = 'BSD'
|
11
|
+
s.license = 'BSD-2-Clause'
|
12
12
|
s.required_ruby_version = '>= 1.9.3'
|
13
|
-
s.add_dependency 'ffi', '>=1.9.3'
|
13
|
+
s.add_dependency 'ffi', '~> 1.9', '>=1.9.3'
|
14
14
|
end
|
data/lib/PAPI.rb
CHANGED
data/lib/PAPI/EventSet.rb
CHANGED
@@ -39,7 +39,6 @@ module PAPI
|
|
39
39
|
number = FFI::MemoryPointer::new(:int)
|
40
40
|
number.write_int(@number)
|
41
41
|
error = PAPI::PAPI_destroy_eventset( number )
|
42
|
-
@number = number.read_int
|
43
42
|
PAPI::error_check(error)
|
44
43
|
return self
|
45
44
|
end
|
@@ -108,6 +107,7 @@ module PAPI
|
|
108
107
|
cid = 0
|
109
108
|
end
|
110
109
|
list = []
|
110
|
+
return nil unless COMPONENTS[cid]
|
111
111
|
if preset and COMPONENTS[cid].preset then
|
112
112
|
events = COMPONENTS[cid].preset
|
113
113
|
else
|
data/lib/PAPI/Thread.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module PAPI
|
2
|
+
attach_function :PAPI_thread_init, [:pointer], :int
|
3
|
+
attach_function :PAPI_register_thread, [], :int
|
4
|
+
attach_function :PAPI_unregister_thread, [], :int
|
5
|
+
attach_function :PAPI_list_threads, [:pointer, :pointer], :int
|
6
|
+
|
7
|
+
def self.thread_init(pointer = nil)
|
8
|
+
pointer = PAPI.ffi_libraries.first.find_function("pthread_self") unless pointer
|
9
|
+
err = PAPI.PAPI_thread_init(pointer)
|
10
|
+
error_check(err)
|
11
|
+
return self
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.register_thread
|
15
|
+
err = PAPI.PAPI_register_thread
|
16
|
+
error_check(err)
|
17
|
+
return self
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.unregister_thread
|
21
|
+
err = PAPI.PAPI_unregister_thread
|
22
|
+
error_check(err)
|
23
|
+
return self
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.list_threads
|
27
|
+
count_p = FFI::MemoryPointer::new(:int)
|
28
|
+
err = PAPI.PAPI_list_threads(nil, count_p)
|
29
|
+
error_check(err)
|
30
|
+
count = count_p.read_int
|
31
|
+
return [] if count == 0
|
32
|
+
id_p = FFI::MemoryPointer::new(:ulong, count)
|
33
|
+
err = PAPI.PAPI_list_threads(id_p, count_p)
|
34
|
+
error_check(err)
|
35
|
+
return id_p.read_array_of_ulong(count)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/lib/PAPI/Version.rb
CHANGED
@@ -4,7 +4,7 @@ module PAPI
|
|
4
4
|
|
5
5
|
extend FFI::Library
|
6
6
|
|
7
|
-
ffi_lib "
|
7
|
+
ffi_lib "papi"
|
8
8
|
attach_function :PAPI_library_init, [ :int ], :int
|
9
9
|
attach_function :PAPI_shutdown, [ ], :void
|
10
10
|
|
@@ -71,21 +71,9 @@ module PAPI
|
|
71
71
|
return nil
|
72
72
|
end
|
73
73
|
|
74
|
-
def self.
|
75
|
-
|
76
|
-
|
77
|
-
9.downto(0) { |revision|
|
78
|
-
9.downto(0) { |increment|
|
79
|
-
v = Version::new(major, minor, revision, increment)
|
80
|
-
res = PAPI_library_init(v)
|
81
|
-
if res == v.to_int then
|
82
|
-
return Version::new(res)
|
83
|
-
end
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
return nil
|
74
|
+
def self.shutdown
|
75
|
+
PAPI_shutdown()
|
76
|
+
return self
|
89
77
|
end
|
90
78
|
|
91
79
|
VERSION = self.init()
|
metadata
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PAPI
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Videau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 1.9.3
|
@@ -21,6 +24,9 @@ dependencies:
|
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.9'
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 1.9.3
|
@@ -37,10 +43,11 @@ files:
|
|
37
43
|
- lib/PAPI/Error.rb
|
38
44
|
- lib/PAPI/Event.rb
|
39
45
|
- lib/PAPI/EventSet.rb
|
46
|
+
- lib/PAPI/Thread.rb
|
40
47
|
- lib/PAPI/Version.rb
|
41
48
|
homepage: https://github.com/Nanosim-LIG/papi-ruby
|
42
49
|
licenses:
|
43
|
-
- BSD
|
50
|
+
- BSD-2-Clause
|
44
51
|
metadata: {}
|
45
52
|
post_install_message:
|
46
53
|
rdoc_options: []
|
@@ -58,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
65
|
version: '0'
|
59
66
|
requirements: []
|
60
67
|
rubyforge_project:
|
61
|
-
rubygems_version: 2.
|
68
|
+
rubygems_version: 2.5.2
|
62
69
|
signing_key:
|
63
70
|
specification_version: 4
|
64
71
|
summary: Ruby PAPI bindings
|