mirror of
https://github.com/manuelkasper/AS-Stats.git
synced 2025-02-20 11:44:12 +08:00
Merge pull request #86 from rlanyi/extractstats-multithread
Add THREADS env var to control number of threads
This commit is contained in:
commit
6cc32ebaa6
@ -42,8 +42,12 @@ my @rrdfiles = File::Find::Rule->maxdepth(2)->file->in($rrdpath);
|
||||
$|=1;
|
||||
my $i :shared = 0;
|
||||
|
||||
my $cpus = do { local @ARGV='/proc/cpuinfo'; grep /^processor\s+:/, <>;};
|
||||
my $num_workers = $cpus / 2;
|
||||
my $num_workers = 1;
|
||||
if (($ENV{'THREADS'}) and ($ENV{'THREADS'} =~ /^\d+$/) and ($ENV{'THREADS'} > 0)) {
|
||||
$num_workers = $ENV{'THREADS'};
|
||||
}
|
||||
print("Using " . $num_workers . " threads.\n");
|
||||
|
||||
my $num_work_units = scalar @rrdfiles;
|
||||
|
||||
my $q = Thread::Queue->new();
|
||||
|
Loading…
x
Reference in New Issue
Block a user