parallel 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,7 @@
1
+ language: ruby
1
2
  before_script:
2
3
  - export TRAVIS=1
4
+ rvm:
5
+ - 1.8.7
6
+ - 1.9.3
7
+ - 2.0.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parallel (0.7.1)
4
+ parallel (0.8.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Readme.md CHANGED
@@ -110,6 +110,7 @@ Authors
110
110
  - [Rob Worley](http://github.com/robworley)
111
111
  - [Tasveer Singh](https://github.com/tazsingh)
112
112
  - [Joachim](https://github.com/jmozmoz)
113
+ - [yaoguai](https://github.com/yaoguai)
113
114
 
114
115
  [Michael Grosser](http://grosser.it)<br/>
115
116
  michael@grosser.it<br/>
@@ -135,18 +135,24 @@ module Parallel
135
135
  end
136
136
 
137
137
  def physical_processor_count
138
- @physical_processor_count ||= case RbConfig::CONFIG['host_os']
139
- when /darwin1/, /freebsd/
140
- `sysctl -n hw.physicalcpu`.to_i
141
- when /linux/
142
- `grep cores /proc/cpuinfo`[/\d+/].to_i
143
- when /mswin|mingw/
144
- require 'win32ole'
145
- wmi = WIN32OLE.connect("winmgmts://")
146
- cpu = wmi.ExecQuery("select NumberOfProcessors from Win32_Processor")
147
- cpu.to_enum.first.NumberOfLogicalProcessors
148
- else
149
- processor_count
138
+ @physical_processor_count ||= begin
139
+ ppc = case RbConfig::CONFIG['host_os']
140
+ when /darwin1/, /freebsd/
141
+ `sysctl -n hw.physicalcpu`.to_i
142
+ when /linux/
143
+ cores_per_physical = `grep cores /proc/cpuinfo`[/\d+/].to_i
144
+ physicals = `grep 'physical id' /proc/cpuinfo |sort|uniq|wc -l`.to_i
145
+ physicals * cores_per_physical
146
+ when /mswin|mingw/
147
+ require 'win32ole'
148
+ wmi = WIN32OLE.connect("winmgmts://")
149
+ cpu = wmi.ExecQuery("select NumberOfProcessors from Win32_Processor")
150
+ cpu.to_enum.first.NumberOfLogicalProcessors
151
+ else
152
+ processor_count
153
+ end
154
+ # fall back to logical count if physical info is invalid
155
+ ppc > 0 ? ppc : processor_count
150
156
  end
151
157
  end
152
158
 
@@ -1,3 +1,3 @@
1
1
  module Parallel
2
- VERSION = Version = '0.7.1'
2
+ VERSION = Version = '0.8.0'
3
3
  end
@@ -36,9 +36,9 @@ describe Parallel do
36
36
  (1..999).should include(Parallel.physical_processor_count)
37
37
  end
38
38
 
39
- it "is half or same as normal cpu" do
39
+ it "is even factor of logical cpus" do
40
40
  pending if ENV["TRAVIS"]
41
- [Parallel.processor_count, Parallel.processor_count / 2].should include Parallel.physical_processor_count
41
+ (Parallel.processor_count % Parallel.physical_processor_count).should == 0
42
42
  end
43
43
  end
44
44
 
metadata CHANGED
@@ -1,49 +1,32 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
- version: !ruby/object:Gem::Version
4
- version: 0.7.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 63
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 8
9
+ - 0
10
+ version: 0.8.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Michael Grosser
9
14
  autorequire:
10
15
  bindir: bin
11
- cert_chain:
12
- - !binary |-
13
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURNakNDQWhxZ0F3SUJB
14
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREEvTVJBd0RnWURWUVFEREFkdGFX
15
- Tm8KWVdWc01SY3dGUVlLQ1pJbWlaUHlMR1FCR1JZSFozSnZjM05sY2pFU01C
16
- QUdDZ21TSm9tVDhpeGtBUmtXQW1sMApNQjRYRFRFek1ESXdNekU0TVRNeE1W
17
- b1hEVEUwTURJd016RTRNVE14TVZvd1B6RVFNQTRHQTFVRUF3d0hiV2xqCmFH
18
- RmxiREVYTUJVR0NnbVNKb21UOGl4a0FSa1dCMmR5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SK0tWNVkxCk5tVkh1THRRY05UWnkrZ1JodDNhaEpSTXVDNlF5TG1r
36
- VHNmKzZNYWVud0FNa0FnSGRzd0dzSnp0T25ObkJhM0YKeTBrQ1NXbUs2RCt4
37
- L1NiZlM2cjdLZTA3TVJxemlKZEI5R3VFMSswY0lSdUZoOEVRK0xONkhYQ0tN
38
- NXBvbi9HVQp5Y3dNWGZsMAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2013-06-30 00:00:00.000000000 Z
16
+ cert_chain: []
17
+
18
+ date: 2013-08-30 00:00:00 Z
40
19
  dependencies: []
20
+
41
21
  description:
42
22
  email: michael@grosser.it
43
23
  executables: []
24
+
44
25
  extensions: []
26
+
45
27
  extra_rdoc_files: []
46
- files:
28
+
29
+ files:
47
30
  - .travis.yml
48
31
  - Gemfile
49
32
  - Gemfile.lock
@@ -87,34 +70,37 @@ files:
87
70
  - spec/parallel_spec.rb
88
71
  - spec/spec_helper.rb
89
72
  homepage: https://github.com/grosser/parallel
90
- licenses:
73
+ licenses:
91
74
  - MIT
92
75
  post_install_message:
93
76
  rdoc_options: []
94
- require_paths:
77
+
78
+ require_paths:
95
79
  - lib
96
- required_ruby_version: !ruby/object:Gem::Requirement
80
+ required_ruby_version: !ruby/object:Gem::Requirement
97
81
  none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- segments:
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
103
87
  - 0
104
- hash: -4028771924496693848
105
- required_rubygems_version: !ruby/object:Gem::Requirement
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
90
  none: false
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- segments:
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
112
96
  - 0
113
- hash: -4028771924496693848
97
+ version: "0"
114
98
  requirements: []
99
+
115
100
  rubyforge_project:
116
101
  rubygems_version: 1.8.25
117
102
  signing_key:
118
103
  specification_version: 3
119
104
  summary: Run any kind of code in parallel processes
120
105
  test_files: []
106
+
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file