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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de3a90256e611c4afea6f7878025745c7eb0a315
4
- data.tar.gz: 92f6fc2183070716de8e5ea002d3a788bfbb897a
3
+ metadata.gz: 0b38abf3baa30222434638a5b1af0cba8f664c47
4
+ data.tar.gz: '079eda46c077084117750f9815221c32c5dcf9b4'
5
5
  SHA512:
6
- metadata.gz: a2713b51238af8b029ce032053fadc9f32d57fdbbdd4b9e746bfb915165de527376e449b5f43088f6fcc3da946669299f56c459af991c3f5769f3402c15acccf
7
- data.tar.gz: 665638d1acd6f0c4f337841335532e446d6ecaa66f9783bdc6a610d737969a7359985d60d15b0c7475a06908443ab7d1a4a143503d4bf4a00ca4adaed5258d7a
6
+ metadata.gz: 953f9b8ec70eff81cea4ccf5b7acb1d79ce79371d9c7f7af41fc7a4507dcefa6b3590fe8dda3589a4cee6b7aeb6e1b0dec1dc49d134c4f89363ace64f277562c
7
+ data.tar.gz: 31499b71710ba897b09c45fe8f6a852bebc80ede2b1b9ccfd8a65903eec7482568e90af9a1679a39e1d068cb613e00933c6f9118ef2522457567adf7edce0dff
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'PAPI'
3
- s.version = "0.101"
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
@@ -1,5 +1,6 @@
1
1
  require 'PAPI/Version.rb'
2
2
  require 'PAPI/Error.rb'
3
+ require 'PAPI/Thread.rb'
3
4
  require 'PAPI/Event.rb'
4
5
  require 'PAPI/Component.rb'
5
6
  require 'PAPI/EventSet.rb'
@@ -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
@@ -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
@@ -4,7 +4,7 @@ module PAPI
4
4
 
5
5
  extend FFI::Library
6
6
 
7
- ffi_lib "libpapi.so"
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.init
75
- 5.downto(3) { |major|
76
- 9.downto(0) { |minor|
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: '0.101'
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: 2015-02-20 00:00:00.000000000 Z
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.2.2
68
+ rubygems_version: 2.5.2
62
69
  signing_key:
63
70
  specification_version: 4
64
71
  summary: Ruby PAPI bindings