#At file:///home/msvensson/mysql/5.1-mtr/ based on revid:bjorn.munch@stripped
3001 Magnus Blåudd 2011-05-06
Bug 12433999 - MTR.PL FIND TOO MANY CPUS
- Implement SysInfo::num_cores() which returns only the number of cores
available in the machine, as opposed to num_cpus() which return also
virtual cpus(aka. hyperthreading or chip multi threading).
- Use the num function instead of num_cpus when calculating the
best value for parallelism in mtr.pl to avoid loading test machines
to much.
modified:
mysql-test/lib/My/SysInfo.pm
mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/lib/My/SysInfo.pm'
--- a/mysql-test/lib/My/SysInfo.pm 2011-01-18 10:03:44 +0000
+++ b/mysql-test/lib/My/SysInfo.pm 2011-05-06 07:54:20 +0000
@@ -168,6 +168,28 @@ sub num_cpus {
}
+# Return the number of cores found
+# - if there is a "core_id" attribute in the
+# cpuinfo, use it to filter out only the count of
+# cores, else return count of cpus
+sub num_cores {
+ my ($self)= @_;
+
+ my $cores = 0;
+ my %seen = (); # Hash with the core id's already seen
+ foreach my $cpu (@{$self->{cpus}}) {
+ my $core_id = $cpu->{core_id};
+
+ next if (defined $core_id and $seen{$core_id}++);
+
+ # Unknown core id or not seen this core before, count it
+ $cores++;
+ }
+ return $cores or
+ confess "INTERNAL ERROR: No cores!";
+}
+
+
# Return the smallest bogomips value amongst the processors
sub min_bogomips {
my ($self)= @_;
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2011-04-18 13:35:14 +0000
+++ b/mysql-test/mysql-test-run.pl 2011-05-06 07:54:20 +0000
@@ -372,7 +372,7 @@ sub main {
# Try to find a suitable value for number of workers
my $sys_info= My::SysInfo->new();
- $opt_parallel= $sys_info->num_cpus();
+ $opt_parallel= $sys_info->num_cores();
for my $limit (2000, 1500, 1000, 500){
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
}
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@oracle.com-20110506075420-enabsyz2tqlf3c23.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-mtr branch (magnus.blaudd:3001) | Magnus Blåudd | 9 May |