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

Delta Between Two Patch Sets: DB/API_REST/draw_link.php

Issue 335100043: DB with histogram
Left Patch Set: db2.0 Created 6 years, 3 months ago
Right Patch Set: Fixing last bug Created 6 years, 3 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « DB/API_REST/draw_graphs.php ('k') | DB/API_REST/img/figure_graphs.jpg » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 <?php
2 ini_set('display_errors', 1);
3 include_once('config.php');
4
5 $output = shell_exec('rm -rf log_graph/*.log ');
6 $file_single_link = 'figure_link.jpg';
7 //$link_post = $_POST['link'];
8 $time_post = $_POST['time'];
9 $file_name = 'single_link.log';
10 $columns_header="object_index";
11 foreach($_POST['check_list'] as $link_post){
12
13 $columns_header = $columns_header . "," . $link_post . " rx_bw" . "," . $link_post . " tx_bw";
14 }
15 $columns_header = $columns_header . "\n";
16 file_put_contents('log_graph/'. $file_name, $columns_header, FILE_APPEND );
17
18 // Loop to store and display values of individual checked checkbox.
19
20 $data_link = [];
21 foreach($_POST['check_list'] as $link_post){
22 $src_switch =str_split($link_post,3)[0];
23 $dst_switch =str_split($link_post,3)[1];
24 $data=$bdd->query("SELECT src_switch, dst_switch, tx_bw, rx_bw, object_i ndex, port, bandwidth FROM topology, port_counters WHERE topology.src_switch = p ort_counters.switch_dpid AND topology.src_sw_port = port_counters.port AND port_ counters.time > DATE_SUB(NOW(), INTERVAL ".$time_post." MINUTE) AND src_switch = '".$src_switch."' AND dst_switch = '".$dst_switch."' ORDER BY port_counters.obj ect_index");
25
26
27
28 while ($link = $data->fetch()) {
29 if (empty($data_link[$link['object_index']])) {
30 $data_link[$link['object_index']]="";
31 }
32 $data_link[$link['object_index']] = $data_link[$link['object_ind ex']] . strval(intval($link['rx_bw']) / $link['bandwidth']) . "," . strval(intva l($link['tx_bw']) / $link['bandwidth']) . ",";
33 }
34
35 }
36
37 foreach ($data_link as $key => $link_utilization) {
38 $to_print = $key . "," . $link_utilization . "\n";
39 file_put_contents('log_graph/'. $file_name, $to_print, FILE_APPEND );················
40
41 }
42
43 shell_exec("gnuplot utils/link.plt");
44 echo "<img src=\"img/".$file_single_link. "\">";
45
46
47
48
49
50
LEFTRIGHT

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