Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added cpu count function

  • Loading branch information...
commit 569690e8c43683f24aa42f6401b1686bbf2e556c 1 parent 478925b
@mariuz authored
Showing with 13 additions and 3 deletions.
  1. +3 −1 getCpuCount.php
  2. +6 −2 kernel-compile.php
  3. +4 −0 tests/exec.php
View
4 getCpuCount.php
@@ -1,6 +1,8 @@
<?php
function getCpuCount()
{
- return "grep -c processor /proc/cpuinfo"
+ exec("grep -c processor /proc/cpuinfo",&$out);
+ return $out[0];
+
}
?>
View
8 kernel-compile.php
@@ -2,8 +2,12 @@
<?
$KERNEL_URL='http://www.kernel.org/';
include_once('./getKernelVersion.php');
+include_once('./getCpuCount.php');
+
$kernel_version=GetStableVersion($KERNEL_URL);
-print ("installing kernel $kernel_version");
+$cpuCount=getCpuCount();
+print("cpu count:$cpuCount");
+print ("compiling kernel $kernel_version");
passthru("apt-get install kernel-package git-core fakeroot ncurses-dev");
chdir("/usr/src");
passthru("wget --continue http://kernel.org/pub/linux/kernel/v2.6/linux-$kernel_version.tar.bz2");
@@ -12,5 +16,5 @@
passthru("cp /boot/config-`uname -r` ./.config");
passthru("make menuconfig");
passthru("make-kpkg clean");
-passthru("fakeroot make-kpkg --initrd --append-to-version=-vanillaice kernel_image kernel_headers");
+passthru("CONCURRENCY_LEVEL=$cpuCount fakeroot make-kpkg --initrd --append-to-version=-vanillaice kernel_image kernel_headers");
?>
View
4 tests/exec.php
@@ -0,0 +1,4 @@
+<?
+exec("grep -c processor /proc/cpuinfo",&$out);
+print $out[0]
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.