/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
require("../../adei.php");

header("Content-type: application/json");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");


$_POST['props'] = "{\"db_server\": \"autogen\", \"db_name\": \"minutely\", \"db_group\": \"default\", \"db_mask\": \"6\", \"experiment\": \"0-0\", \"window\": \"1104537600-1262304000,-2:2\", \"width\": 1024, \"height\": 768, \"hide_axes\": 0, \"show_gaps\": \"POINTS\"}";

try {
    $req = new REQUEST();
    if ($req->CheckData()) {
	$req = $req->CreateDataRequest();

	
	$time[1] = gettimeofday(true);
	$draw = $req->CreatePlotter();
//	print_r($draw->cache->req);
	$time[2] = gettimeofday(true);
	$draw->Create();
	$time[3] = gettimeofday(true);
	$file = $draw->Save();
	$time[4] = gettimeofday(true);
	$scale = $draw->GetScaleInfo();
	$time[5] = gettimeofday(true);

	foreach ($time as $i => $tm) {
	    echo $tm . " - " . $i . "\n";
	}
	echo "Main computations: " . ($time[4] - $time[3]) . "\n";

	echo time() . " - 3\n";
	echo time() . " - Starting\n";
    }
} catch(ADEIException $e) {
    $error = $e->getMessage();
}

if ($error) {
    echo json_encode(array("error" => $error));
} else {
    if ($draw) {
	echo json_encode(array_merge(array(
	    "error" => 0,
	    "module" => "graph",
	    "draw" => 1,
	    "image" => $file
	), $scale));
    } else {
	echo json_encode(array("error" => 0));
    }
}


?>