From 8104dfe38b6a5faa4f1648765f9869b209714c13 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 12 Sep 2011 10:50:13 +0200 Subject: [PATCH] return user_hz from POSIX::_SC_CLK_TCK and remove that jiffie code (which is totally wrong) --- data/PVE/ProcFSTools.pm | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/data/PVE/ProcFSTools.pm b/data/PVE/ProcFSTools.pm index 938dae2..dd22c4b 100644 --- a/data/PVE/ProcFSTools.pm +++ b/data/PVE/ProcFSTools.pm @@ -10,22 +10,16 @@ my $clock_ticks = POSIX::sysconf(&POSIX::_SC_CLK_TCK); my $cpuinfo; -# cycles_per_jiffy = frequency_of_your_cpu/jiffies_per_second -# jiffies_per_second = 1000 - -# frequency_of_your_cpu can be read from /proc/cpuinfo, as: -# cpu MHz : - sub read_cpuinfo { my $fn = '/proc/cpuinfo'; return $cpuinfo if $cpuinfo; my $res = { + user_hz => $clock_ticks, model => 'unknown', mhz => 0, cpus => 1, - cpu_cycles_per_jiffy => 0, }; my $fh = IO::File->new ($fn, "r"); @@ -39,7 +33,6 @@ sub read_cpuinfo { $res->{model} = $1 if $res->{model} eq 'unknown'; } elsif ($line =~ m/^cpu\s+MHz\s*:\s*(\d+\.\d+)\s*$/i) { $res->{mhz} = $1 if !$res->{mhz}; - $res->{cpu_cycles_per_jiffy} += $1 * 1000; } elsif ($line =~ m/^flags\s*:.*(vmx|svm)/) { $res->{hvm} = 1; # Hardware Virtual Machine (Intel VT / AMD-V) } -- 2.39.2