Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(61)

Side by Side Diff: DB/show_graph.php

Issue 335100043: DB with histogram
Patch Set: DB Created 6 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DB/request.php ('k') | DB/thread_database.php » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <?php 1 <?php
2 ini_set('display_errors', 1); 2 //this file is to print all the link and ask the time to draw the graphs if the client choose the option to print the link utilization link by link or just ask the time to draw the graphs if the client choose the option to print the average link utilization
3 3 include_once('config.php'); ///connect to the DB
4 include_once('config.php'); 4 $output = shell_exec('rm -rf log_graph/*.log '); //clean the log_file
5 $link_capacity = 300; //Mb/s
6 $output = shell_exec('rm -rf log_graph/*.log ');
7 5
8 if($_SERVER['REQUEST_METHOD'] == "GET"){ 6 if($_SERVER['REQUEST_METHOD'] == "GET"){
9 $get_request = $_GET; 7 $get_request = $_GET;
10 8 //if we have request GET of type 1, that means that the client ask to print link utlization link by link
11 if(strcmp($get_request['x'], '1') == 0 ){ 9 if(strcmp($get_request['x'], '1') == 0 ){
12 10 » » // this SQL request select every link in the topology table
13 $all_link = $bdd->query("SELECT src_switch, dst_switch FROM topo logy WHERE event = 'link_up' AND src_switch < dst_switch ORDER BY src_switch "); 11 $all_link = $bdd->query("SELECT src_switch, dst_switch FROM topo logy WHERE event = 'link_up' AND src_switch < dst_switch ORDER BY src_switch ");
14 » »······· 12 » » //then we print them with a checkbox to allow the client to choo se the links he want
15 echo "<h1>See all the link below</h1>"; 13 echo "<h1>See all the link below</h1>";
16 echo "</br>"."error database: "; 14 echo "</br>"."error database: ";
17 if($all_link->errorCode()==0){ 15 if($all_link->errorCode()==0){
18 echo "no error"; 16 echo "no error";
19 }else{ 17 }else{
20 echo "error: "; 18 echo "error: ";
21 print_r($all_link->errorInfo()); 19 print_r($all_link->errorInfo());
22 } 20 }
23 echo "</br>"; 21 echo "</br>";
24 echo "<form action=\"draw_link.php\" method=\"post\">"; 22 echo "<form action=\"draw_link.php\" method=\"post\">";
25 while ($link = $all_link->fetch()) { 23 while ($link = $all_link->fetch()) {
26 $hyperlink = $link['src_switch'] . $link['dst_switch']; 24 $hyperlink = $link['src_switch'] . $link['dst_switch'];
27 echo "<input type=\"checkbox\" name=\"check_list[]\" val ue=\"".$hyperlink."\"><label>".$hyperlink."</label>". " "; 25 echo "<input type=\"checkbox\" name=\"check_list[]\" val ue=\"".$hyperlink."\"><label>".$hyperlink."</label>". " ";
28 } 26 }
27 //then we ask him the time he want
29 echo " 28 echo "
30 </br> 29 </br>
31 <input type=\"text\" name=\"time\" placeholder=\"time (m in)\" /> 30 <input type=\"text\" name=\"time\" placeholder=\"time (m in)\" />
32 <input type=\"submit\" value=\"Show\" /> 31 <input type=\"submit\" value=\"Show\" />
33 </p> "; 32 </p> ";
34 33
35 } 34 }
36 35 //if we have request GET of type 0, that means that the client ask to print aver age link utlization
36 //so we just ask the time for the x axis
37 if(strcmp($get_request['x'], '0') == 0 ){ 37 if(strcmp($get_request['x'], '0') == 0 ){
38 echo " 38 echo "
39 <form action=\"draw_graphs.php\" method=\"post\"> 39 <form action=\"draw_graphs.php\" method=\"post\">
40 <p> 40 <p>
41 <input type=\"text\" name=\"time\" placeholder=\"time (m in)\" /> 41 <input type=\"text\" name=\"time\" placeholder=\"time (m in)\" />
42 <input type=\"submit\" value=\"Show\" /> 42 <input type=\"submit\" value=\"Show\" />
43 </p> "; 43 </p> ";
44 44
45 } 45 }
46 46
47 47
48 } 48 }
49 49
OLDNEW
« no previous file with comments | « DB/request.php ('k') | DB/thread_database.php » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b