Added lot of junk laying around on harvie.cz
[mirrors/Programs.git] / php / skripty / cpuload.php
1 <?php
2 //CPULoad
3
4 function getmicrotime(){
5 list($usec, $sec) = explode(" ",microtime());
6 return ((float)$usec);
7 }
8
9
10 $c = 0;
11 $ind = 0;
12 while($c < 0.3) { // max 0.3
13 $a = getmicrotime();
14
15 ////////////////////////////////////////////////////////////////
16 /*
17 for ($i=0; $i < 1000; $i++){
18 $x = cos(sin(cos(sin(cos(sin(60))))));
19 }
20 */
21
22 $desc = array(
23 0 => array("pipe", "r"), // stdin is a pipe that the child will read from
24 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
25 2 => array("pipe", "r") // stderr is a file to write to
26 );
27
28 $proc[$ind] = proc_open("proctest.exe", $desc, $pipes);
29 $ind = ($ind + 1);
30
31 ////////////////////////////////////////////////////////////////
32
33 $b = getmicrotime();
34 $c = round(($b - $a), 10);
35 echo($c."\n");
36
37 }
38
39 echo("end");
40 system("taskkill /f /im proctest.exe");
41 echo("OK");
42 ?>
This page took 0.314009 seconds and 4 git commands to generate.