source: branches/help/util/usecores.pl

Last change on this file was 13818, checked in by westram, 10 years ago
  • do not use more than 80% of cores
  • run at least 2 jobs (on single cores)
  • Property svn:executable set to *
File size: 401 bytes
Line 
1#!/usr/bin/perl
2
3# determines cores used by jenkins builds
4my $cores = `cat /proc/cpuinfo | grep processor | wc -l`; # no /proc/cpuinfo (e.g. on OSX) -> falls back to minimum
5if ($cores<1) { $cores = 1; }
6
7my $usedcores = int($cores * 0.8); # reserve some cores for docker etc.
8if ($usedcores<1) { $usedcores = 1; }
9
10my $jobs = ($usedcores < 2) ? 2 : $usedcores; # use at least 2 jobs
11print "$jobs";
12
Note: See TracBrowser for help on using the repository browser.