[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8867 - in GNUnet/contrib: . profiling
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8867 - in GNUnet/contrib: . profiling |
Date: |
Fri, 28 Aug 2009 12:06:16 -0600 |
Author: nevans
Date: 2009-08-28 12:06:15 -0600 (Fri, 28 Aug 2009)
New Revision: 8867
Added:
GNUnet/contrib/profiling/
GNUnet/contrib/profiling/queries.cgi
GNUnet/contrib/profiling/routes.cgi
GNUnet/contrib/profiling/table.cgi
GNUnet/contrib/profiling/trial.cgi
GNUnet/contrib/profiling/trialsToRun.cgi
GNUnet/contrib/profiling/welcome.cgi
Log:
web interface for dht testing
Added: GNUnet/contrib/profiling/queries.cgi
===================================================================
--- GNUnet/contrib/profiling/queries.cgi (rev 0)
+++ GNUnet/contrib/profiling/queries.cgi 2009-08-28 18:06:15 UTC (rev
8867)
@@ -0,0 +1,167 @@
+#!/usr/bin/perl
+use DBD::mysql;
+use CGI;
+require "/var/www/localhost/htdocs/dht/serverConf.pl";
+my $c = new CGI;
+$c->header;
+
+$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+$dbh = DBI->connect($dsn, $user, $password);
+%topologies = (0 => "Clique", 1 => "Small World", 2 => "Ring", 3 =>
"2d-Torus", 4 => "Erdos-Renyi", 5 => "InterNAT");
+%requests = (1 => "GET", 2 => "PUT", 3 => "REPLY", "" => "ALL");
+%success = ("" => "All", 1 => "Successful", 0 => "Failed");
+%boolean = (0 => "No", 1 => "Yes");
+$trialuid = $c->param("trialuid");
+$querytype = $c->param("querytype");
+$succeeded = $c->param("succeeded");
+print <<ENDHTML;
+<html>
+<head>
+<title>$success{$succeeded} $requests{$querytype} details for trial
$trialuid</title>
+<style>
+td {color:black;font-family:verdana}
+a {color:black}
+h2 {color:black;font-family:verdana}
+td { padding-top: 1px;padding-bottom: 1px;padding-left: 4px;padding-right:
4px;}
+td.inner {text-align:center}
+
+</style>
+</head>
+
+<body id="body" bgcolor=beige style="text-align:center">
+<br/>
+<h2>$success{$succeeded} $requests{$querytype} details for <a
href=\"trial.cgi?trialuid=$trialuid\">trial $trialuid</a></h2>
+
+<br/>
+
+ENDHTML
+
+if ($trialuid eq "")
+{
+ return 0;
+}
+if (($querytype != 1) && ($querytype != 2) && ($querytype != 3))
+{
+ $querytype = "";
+}
address@hidden = ();
address@hidden = ();
address@hidden = ();
address@hidden = ();
address@hidden = ();
address@hidden = ();
address@hidden = ();
+
+if ($succeeded eq "")
+{
+ $succeeded = 42;
+}
+if ($querytype eq "")
+{
+ $rth = $dbh->prepare("select * from queries where trialuid=$trialuid");
+ $rth->execute();
+ while ($data = $rth->fetchrow_hashref())
+ {
+ push (@queryuids, $$data{'queryuid'});
+ push (@dhtqueryids, $$data{'dhtqueryid'});
+ push (@querytypes, $$data{'querytype'});
+ push (@hops, $$data{'hops'});
+ push (@successes, $$data{'succeeded'});
+ push (@nodeuids, $$data{'nodeuid'});
+ push (@dhtkeyuids, $$data{'dhtkeyuid'});
+ }
+}
+elsif (($succeeded == 1) || ($succeeded == 0))
+{
+ $rth = $dbh->prepare("select * from queries where trialuid=$trialuid and
querytype=$querytype order by dhtkeyuid");
+ $rth->execute();
+
+ $rthfailed = $dbh->prepare("select * from queries where trialuid=$trialuid
and querytype=$querytype and succeeded=0 and hops=0 order by dhtkeyuid");
+ $rthfailed->execute();
+
+ $rthkeys = $dbh->prepare("select distinct dhtkeyuid from queries where
trialuid=$trialuid and querytype=$querytype and succeeded=1 order by
dhtkeyuid");
+ $rthkeys->execute();
+ while ($keydata = $rthkeys->fetchrow_hashref())
+ {
+ push (@successful_dhtkeyuids, $$keydata{'dhtkeyuid'});
+ }
+ #print ("<h3>size of successful_dhtkeyuids is " . @successful_dhtkeyuids .
"</h3>\n");
+ while ($data = $rth->fetchrow_hashref())
+ {
+ if ((($succeeded == 1) && ($$data{'succeeded'} == 1)) || (($succeeded ==
0) && (!(inArr(address@hidden, $$data{'dhtkeyuid'})))))
+ {
+ push (@queryuids, $$data{'queryuid'});
+ push (@dhtqueryids, $$data{'dhtqueryid'});
+ push (@querytypes, $$data{'querytype'});
+ push (@hops, $$data{'hops'});
+ push (@successes, $$data{'succeeded'});
+ push (@nodeuids, $$data{'nodeuid'});
+ push (@dhtkeyuids, $$data{'dhtkeyuid'});
+ }
+ }
+}
+else
+{
+ $rth = $dbh->prepare("select * from queries where trialuid=$trialuid and
querytype=$querytype order by dhtkeyuid");
+ $rth->execute();
+ while ($data = $rth->fetchrow_hashref())
+ {
+ push (@queryuids, $$data{'queryuid'});
+ push (@dhtqueryids, $$data{'dhtqueryid'});
+ push (@querytypes, $$data{'querytype'});
+ push (@hops, $$data{'hops'});
+ push (@successes, $$data{'succeeded'});
+ push (@nodeuids, $$data{'nodeuid'});
+ push (@dhtkeyuids, $$data{'dhtkeyuid'});
+ }
+}
+
+print <<ENDHTML;
+ <table border="1" align=center>
+ <tr>
+ <td class="inner"><b>Count</b></td><td
class="inner"><b>Queryuid</b></td><td class="inner"><b>DHT Query
UID</b></td><td class="inner"><b>Query Type</b></td><td
class="inner"><b>Hops</b></td><td><b>Succeeded</b></td><td><b>Node
UID</b></td><td class="inner"><b>DHT Key</b></td>
+ </tr>
+ENDHTML
+
+my $count = 0;
+foreach $datum (@queryuids)
+{
+ my $table_line =
+ "<tr>
+ <td class=\"inner\">$count</td>
+ <td class=\"inner\"><a
href=\"routes.cgi?trialuid=$trialuid&dhtqueryid=$queryuids[$count]&querytype=$querytypes[$count]\">$queryuids[$count]</a></td>
+ <td class=\"inner\"><a
href=\"routes.cgi?trialuid=$trialuid&dhtqueryid=$dhtqueryids[$count]&querytype=$querytypes[$count]\">$dhtqueryids[$count]</a></td>
+ <td class=\"inner\">$requests{$querytypes[$count]}</td>
+ <td class=\"inner\">$hops[$count]</td>
+ <td class=\"inner\">$boolean{$successes[$count]}</td>
+ <td class=\"inner\">$nodeuids[$count]</td>
+ <td class=\"inner\">$dhtkeyuids[$count]</td>
+ </tr>";
+ print $table_line . "\n";
+ $count++;
+}
+
+print("</table>");
+
+sub getCount
+{
+ my $new_rth = shift;
+ $new_rth->execute();
+ my @data = $new_rth->fetchrow_array();
+ return $data[0];
+}
+
+sub inArr
+{
+ my $array_ref = shift;
+ my $value = shift;
+
+ foreach $item (@{$array_ref})
+ {
+ if ($item eq $value)
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
\ No newline at end of file
Added: GNUnet/contrib/profiling/routes.cgi
===================================================================
--- GNUnet/contrib/profiling/routes.cgi (rev 0)
+++ GNUnet/contrib/profiling/routes.cgi 2009-08-28 18:06:15 UTC (rev 8867)
@@ -0,0 +1,325 @@
+#!/usr/bin/perl
+use DBD::mysql;
+use CGI;
+require "/var/www/localhost/htdocs/dht/serverConf.pl";
+my $c = new CGI;
+$c->header;
+
+$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+$dbh = DBI->connect($dsn, $user, $password);
+%topologies = (0 => "Clique", 1 => "Small World", 2 => "Ring", 3 =>
"2d-Torus", 4 => "Erdos-Renyi", 5 => "InterNAT");
+%requests = (1 => "GET", 2 => "PUT", 3 => "REPLY", "" => "ALL");
+%success = ("" => "All", 1 => "Successful", 0 => "Failed");
+$trialuid = $c->param("trialuid");
+$dhtqueryid = $c->param("dhtqueryid");
+$querytype = $c->param("querytype");
+
+print <<ENDHTML;
+<html>
+<head>
+<title>Route details for request $dhtqueryid</title>
+<style>
+td {color:black;font-family:verdana}
+a {color:black}
+h2 {color:black;font-family:verdana}
+td { padding-top: 1px;padding-bottom: 1px;padding-left: 4px;padding-right:
4px;}
+td.inner {text-align:center}
+
+</style>
+</head>
+
+<body id="body" bgcolor=beige style="text-align:center">
+<br/>
+<h2>Route details for request $dhtqueryid</h2>
+
+<br/>
+
+ENDHTML
+
+if ($trialuid eq "")
+{
+ return 0;
+}
+
+
+print <<ENDHTML;
+ <table border="1" align=center>
+ <tr>
+ <td class="inner"><b>Count</b></td>
+ <td class="inner"><b>DHT Query UID</b></td>
+ <td class="inner"><b>Query Type</b></td>
+ <td class="inner"><b>Hops</b></td>
+ <td class="inner"><b>DV Hops</b></td>
+ <td><b>Succeeded</b></td>
+ <td><b>Node UID</b></td>
+ <td class="inner"><b>DHT Key</b></td>
+ <td class="inner"><b>From Node</b></td>
+ <td class="inner"><b>To Node</b></td>
+ </tr>
+ENDHTML
+
+my $count = 0;
+
+$rth = $dbh->prepare("select * from routes where trialuid=$trialuid and
dhtqueryid=$dhtqueryid and querytype=$querytype");
+$rth->execute();
+while ($data = $rth->fetchrow_hashref())
+{
+ my $table_line =
+ "<tr>
+ <td class=\"inner\">$count</td>
+ <td class=\"inner\">$$data{'dhtqueryid'}</td>
+ <td class=\"inner\">$$data{'querytype'}</td>
+ <td class=\"inner\">$$data{'hops'}</td>
+ <td class=\"inner\">$$data{'dvhops'}</td>
+ <td class=\"inner\">$$data{'succeeded'}</td>
+ <td class=\"inner\">$$data{'nodeuid'}</td>
+ <td class=\"inner\">$$data{'dhtkeyuid'}</td>
+ <td class=\"inner\">$$data{'from_node'}</td>
+ <td class=\"inner\">$$data{'to_node'}</td>
+ </tr>";
+ print $table_line . "\n";
+ $count++;
+ $dhtkey = $$data{'dhtkeyuid'};
+}
+
+print("</table>");
+
+print <<ENDHTML;
+ <h3>Closest Node(s) to Query Key</h3>
+ <table border="1" align=center>
+ <tr>
+ <td class="inner"><b>DHT Key UID</b></td>
+ <td class="inner"><b>Node UID</b></td>
+ <td class="inner"><b>Inverse Bit Distance</b></td>
+ </tr>
+ENDHTML
+
+$rth = $dbh->prepare("select * from dhtkeys where dhtkeyuid=$dhtkey");
+$rth->execute();
+
+$location = "";
address@hidden = ();
+$trialuid = 0;
+while ($data = $rth->fetchrow_hashref())
+{
+ @tempkeyid = split(//, $$data{'keybits'});
+ $numbits = @tempkeyid;
+ $location = "";
+ for ($i = 0; $i < $numbits; $i++)
+ {
+ $bits = unpack "B8", $tempkeyid[$i];
+ @reversedbits;
+ $reversebits = reverse($bits);
+ #print "$bits is the bits?\n";
+ #print "$reversebits is the bits?\n";
+ $location = $location . $reversebits;
+ }
+ @locationarr = split(//, $location);
+ $trialuid = $$data{'trialuid'};
+}
+
+$rth = $dbh->prepare("select nodeuid, nodebits from nodes where
trialuid=$trialuid");
+$rth->execute();
+
+$max = 0;
address@hidden = ();
+while ($data = $rth->fetchrow_hashref())
+{
+ @tempnodeid = split(//, $$data{'nodebits'});
+ $numbits = @tempnodeid;
+
+ $location = "";
+ for ($i = 0; $i < $numbits; $i++)
+ {
+ $bits = unpack "B8", $tempnodeid[$i];
+ @reversedbits;
+ $reversebits = reverse($bits);
+ $location = $location . $reversebits;
+ }
+ @nodelocationarr = split(//, $location);
+
+ $curr_dist = getDistance(address@hidden, address@hidden);
+ if ($curr_dist > $max)
+ {
+ @maxarr = ();
+ push (@maxarr, $$data{'nodeuid'});
+ $max = $curr_dist;
+ }
+ elsif ($curr_dist == $max)
+ {
+ push (@maxarr, $$data{'nodeuid'});
+ }
+}
+
+foreach $uid (@maxarr)
+{
+print <<ENDHTML;
+ <tr>
+ <td class="inner"><b>$dhtkey</b></td>
+ <td class="inner"><b>$uid</b></td>
+ <td class="inner"><b>$max</b></td>
+ </tr>
+ENDHTML
+}
+
+print ("</table>\n");
+
+if (!(-e
"/var/www/localhost/htdocs/dht/tmp_graphs/$dhtqueryid-$querytype.png"))
+{
+ `/var/www/localhost/htdocs/dht/graphRoute.pl $dhtqueryid $querytype`;
+}
+
address@hidden;
address@hidden;
address@hidden;
+
+if ($querytype == 1)
+{
+ if (!(-e "/var/www/localhost/htdocs/dht/tmp_graphs/$dhtqueryid-3.png"))
+ {
+ `/var/www/localhost/htdocs/dht/graphRoute.pl $dhtqueryid 3`;
+ }
+
+ if (-e "/var/www/localhost/htdocs/dht/tmp_graphs/$dhtqueryid-3.png")
+ {
+ push (@associated_replies, $dhtqueryid);
+ }
+ $rth = $dbh->prepare("select * from routes where trialuid=$trialuid and
querytype=2 and dhtkeyuid=$dhtkey and hops = 0 and succeeded = 0");
+ $rth->execute();
+ while ($data = $rth->fetchrow_hashref())
+ {
+ if (!(-e
"/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'dhtqueryid'}-2"))
+ {
+ `/var/www/localhost/htdocs/dht/graphRoute.pl $$data{'dhtqueryid'} 2`;
+ }
+
+ if (-e
"/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'dhtqueryid'}-2.png")
+ {
+ push (@associated_puts, $$data{'dhtqueryid'});
+ }
+ }
+}
+elsif ($querytype == 2)
+{
+ $rth = $dbh->prepare("select * from routes where trialuid=$trialuid and
querytype=1 and dhtkeyuid=$dhtkey and hops = 0 and succeeded = 0");
+ $rth->execute();
+ while ($data = $rth->fetchrow_hashref())
+ {
+ if (!(-e "/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'queryuid'}-1"))
+ {
+ `/var/www/localhost/htdocs/dht/graphRoute.pl $$data{'queryuid'} 1`;
+ }
+
+ if (-e "/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'queryuid'}-1")
+ {
+ push (@associated_gets, $$data{'queryuid'});
+ }
+ }
+
+ $rth = $dbh->prepare("select * from routes where trialuid=$trialuid and
querytype=3 and dhtkeyuid=$dhtkey and hops = 0 and succeeded = 0");
+ $rth->execute();
+ while ($data = $rth->fetchrow_hashref())
+ {
+ if (!(-e "/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'queryuid'}-3"))
+ {
+ `/var/www/localhost/htdocs/dht/graphRoute.pl $$data{'queryuid'} 3`;
+ }
+ print "<h3>found associated reply $$data{'queryuid'}</h3>\n";
+ if (-e "/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'queryuid'}-3")
+ {
+ push (@associated_replies, $$data{'queryuid'});
+ }
+ }
+}
+elsif ($querytype == 3)
+{
+ if (!(-e "/var/www/localhost/htdocs/dht/tmp_graphs/$dhtqueryid-1.png"))
+ {
+ `/var/www/localhost/htdocs/dht/graphRoute.pl $dhtqueryid 1`;
+ }
+ print "<h3>found associated reply $dhtqueryid</h3>\n";
+ if (-e "/var/www/localhost/htdocs/dht/tmp_graphs/$dhtqueryid-1.png")
+ {
+ push (@associated_gets, $dhtqueryid);
+ }
+ $rth = $dbh->prepare("select distinct dhtqueryid from routes where
trialuid=$trialuid and querytype=2 and dhtkeyuid=$dhtkey and hops = 0 and
succeeded = 0");
+ $rth->execute();
+ while ($data = $rth->fetchrow_hashref())
+ {
+ if (!(-e
"/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'dhtqueryid'}-2.png"))
+ {
+ `/var/www/localhost/htdocs/dht/graphRoute.pl $$data{'dhtqueryid'} 2`;
+ }
+
+ if (-e
"/var/www/localhost/htdocs/dht/tmp_graphs/$$data{'dhtqueryid'}-2.png")
+ {
+ push (@associated_puts, $$data{'dhtqueryid'});
+ }
+ }
+}
+
+print <<ENDHTML;
+<table align=center>
+ <tr><td class="inner">Graph of $requests{$querytype} query route</td></tr>
+ <tr><td><img src="tmp_graphs/$dhtqueryid-$querytype.png" /></td></tr>
+</table>
+ENDHTML
+
+foreach $graph (@associated_puts)
+{
+print <<ENDHTML;
+<table align=center>
+ <tr><td class="inner">Graph of related put query route</td></tr>
+ <tr><td><img src="tmp_graphs/$graph-2.png" /></td></tr>
+</table>
+ENDHTML
+}
+
+foreach $graph (@associated_gets)
+{
+print <<ENDHTML;
+<table align=center>
+ <tr><td class="inner">Graph of related get query route</td></tr>
+ <tr><td><img src="tmp_graphs/$graph-1.png" /></td></tr>
+</table>
+ENDHTML
+}
+
+foreach $graph (@associated_replies)
+{
+print <<ENDHTML;
+<table align=center>
+ <tr><td class="inner">Graph of related reply query route</td></tr>
+ <tr><td><img src="tmp_graphs/$graph-3.png" /></td></tr>
+</table>
+ENDHTML
+}
+
+sub getCount
+{
+ my $new_rth = shift;
+ $new_rth->execute();
+ my @data = $new_rth->fetchrow_array();
+ return $data[0];
+}
+
+sub getDistance
+{
+ $locarrkey = shift;
+ $locarrnode = shift;
+
+ my $keylocsize = @{$locarrkey};
+ my $nodelocsize = @{$locarrnode};
+
+ if ($keylocsize != $nodelocsize)
+ {
+ print "Key location and node location differ in size?!?\n";
+ return -1;
+ }
+ my $matchcount = 0;
+ while (@{$locarrkey}[$matchcount] == @{$locarrnode}[$matchcount])
+ {
+ $matchcount++;
+ }
+ return $matchcount;
+}
\ No newline at end of file
Added: GNUnet/contrib/profiling/table.cgi
===================================================================
--- GNUnet/contrib/profiling/table.cgi (rev 0)
+++ GNUnet/contrib/profiling/table.cgi 2009-08-28 18:06:15 UTC (rev 8867)
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+use DBI;
+use DBD::mysql;
+use CGI;
+require "/var/www/localhost/htdocs/dht/serverConf.pl";
+my $c = new CGI;
+$c->header;
+
+$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+$dbh = DBI->connect($dsn, $user, $password);
+
+$trialuid = $c->param("trialuid");
+print <<ENDHTML;
+<html>
+<head>
+ENDHTML
+print("<title>Trial $trialuid Details</title>");
+print <<ENDHTML;
+<style>
+td {color:white;font-family:verdana}
+a {color:white}
+</style>
+</head>
+
+<body id="body" bgcolor=green style="text-align:center">
+<br/>
+<div><font color=white face=verdana size=+3>Trial List</font></div>
+<br/>
+ <table border="1" align=center>
+ <tr>
+ <td><b>Trial ID</b></td><td><b>#
Nodes</b></td><td><b>Topology</b></td><td><b>Start Time</b></td><td><b>End
Time</b></td><td><b># Puts</b></td><td><b>#Gets</b></td><td><b>Concurrent
Requests</b></td><td><b>Settle Time</b></td><td><b>Total Connections</b></td>
+ </tr>
+
+ENDHTML
+
+my $rth = $dbh->prepare("select * from trials where trialuid=$trialuid");
+$rth->execute();
+
+while($data = $rth->fetchrow_hashref())
+{
+ my $table_line = "<tr><td><a
href=\"table.cgi?tableuid=$$data{'trialuid'}\">$$data{'trialuid'}</a></td><td>$$data{'numnodes'}</td><td>$$data{'topology'}</td><td>$$data{'starttime'}</td><td>$$data{'endtime'}</td><td>$$data{'puts'}</td><td>$$data{'gets'}</td><td>$$data{'concurrent'}</td><td>$$data{'settle_time'}</td><td>$$data{'totalConnections'}</td></tr>";
+ print $table_line . "\n";
+}
+print("</table>\n");
+
+
+print("</body>\n</html>\n");
Property changes on: GNUnet/contrib/profiling/table.cgi
___________________________________________________________________
Added: svn:executable
+ *
Added: GNUnet/contrib/profiling/trial.cgi
===================================================================
--- GNUnet/contrib/profiling/trial.cgi (rev 0)
+++ GNUnet/contrib/profiling/trial.cgi 2009-08-28 18:06:15 UTC (rev 8867)
@@ -0,0 +1,315 @@
+#!/usr/bin/perl
+use DBD::mysql;
+use CGI;
+require "/var/www/localhost/htdocs/dht/serverConf.pl";
+my $c = new CGI;
+$c->header;
+
+$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+$dbh = DBI->connect($dsn, $user, $password);
+%topologies = (0 => "Clique", 1 => "Small World", 2 => "Ring", 3 =>
"2d-Torus", 4 => "Erdos-Renyi", 5 => "InterNAT");
+$trialuid = $c->param("trialuid");
+print <<ENDHTML;
+<html>
+<head>
+<title>Trial $trialuid Details</title>
+<style>
+td {color:black;font-family:verdana}
+a {color:black}
+h2 {color:black;font-family:verdana}
+td { padding-top: 1px;padding-bottom: 1px;padding-left: 4px;padding-right:
4px;}
+td.inner {text-align:center}
+
+</style>
+</head>
+
+<body id="body" bgcolor=beige style="text-align:center">
+<br/>
+<h2>Trial $trialuid Info</h2>
+<br/>
+ <table border="1" align=center>
+ <tr>
+ <td><b>Trial ID</b></td>
+ <td class="inner"><b># Nodes</b></td>
+ <td class="inner"><b>Topology</b></td>
+ <td class="inner"><b>Topology<br/>Modifier</b></td>
+ <td class="inner"><b>Log<br/>Multiplier</b></td>
+ <td><b># Puts</b></td><td><b>#Gets</b></td>
+ <td class="inner"><b>Concurrent<br/>Requests</b></td>
+ <td class="inner"><b>Settle<br/>Time</b></td>
+ <td class="inner"><b>Total<br/>Connections</b></td>
+ <td class="inner"><b>Average<br/>Connections</b></td>
+ <td class="inner"><b>ln(N)<br/>Multiplier</b></td>
+ <td class="inner"><b>Messages<br/>Dropped</b></td>
+ <td class="inner"><b>Bytes<br/>Dropped</b></td>
+ <td class="inner"><b>Trial<br/>Comment</b></td>
+ </tr>
+
+ENDHTML
+
+my $rth = $dbh->prepare("select * from trials where trialuid=$trialuid");
+$rth->execute();
+
+while($data = $rth->fetchrow_hashref())
+{
+ my $topology_int = $$data{'topology'};
+
+ $numNodes = $$data{'numnodes'};
+ $topology = $topologies{$topology_int};
+ $totalConnections = $$data{'totalConnections'};
+ $averageConnections = int(100 *
($$data{'totalConnections'}/$$data{'numnodes'}))/100;
+ $logNMultiplier = int(100 * ($averageConnections / log($numNodes)))/100;
+
+ my $table_line = "<tr>
+ <td class=\"inner\"><a
href=\"trial.cgi?trialuid=$$data{'trialuid'}\">$$data{'trialuid'}</a></td>
+ <td class=\"inner\">$$data{'numnodes'}</td>
+ <td class=\"inner\">$topologies{$topology_int}</td>
+ <td class=\"inner\">$$data{'topology_modifier'}</td>
+ <td class=\"inner\">$$data{'logNMultiplier'}</td>
+ <td class=\"inner\">$$data{'puts'}</td>
+ <td class=\"inner\">$$data{'gets'}</td>
+ <td class=\"inner\">$$data{'concurrent'}</td>
+ <td class=\"inner\">$$data{'settle_time'}</td>
+ <td class=\"inner\">$$data{'totalConnections'}</td>
+ <td class=\"inner\">" . int(100 *
($$data{'totalConnections'}/$$data{'numnodes'}))/100 . "</td>
+ <td class=\"inner\">" . int(100 * log($$data{'numnodes'}))/100 . "</td>
+ <td class=\"inner\">$$data{'totalMessagesDropped'}</td>
+ <td class=\"inner\">$$data{'totalBytesDropped'}</td>
+ <td class=\"inner\">$$data{'message'}</td>
+ </tr>";
+ print $table_line . "\n";
+}
+print("</table>\n");
+
+#Select for number of malicious puts initiated
+my $rth = $dbh->prepare("select count(*) from queries where trialuid=$trialuid
and querytype = 2 and succeeded = 0 and hops = 0");
+$num_malicious_puts = 0;
+
+#Select for number of puts initiated
+my $rth = $dbh->prepare("select count(*) from queries where trialuid=$trialuid
and querytype = 2 and succeeded = 0 and hops = 0");
+$num_puts = getCount($rth);
+
+#Select for number of puts that succeeded
+my $rth = $dbh->prepare("select count(distinct dhtkeyuid) from queries where
trialuid=$trialuid and querytype = 2 and succeeded = 1");
+$num_puts_succeeded = getCount($rth);
+$num_puts_failed = $num_puts - $num_puts_succeeded;
+
+if ($num_puts > 0)
+{
+ $percent_puts_succeeded = int(100 * ($num_puts_succeeded/$num_puts))/100;
+}
+else
+{
+ $percent_puts_succeeded = 0;
+}
+
+#Select for all puts that succeeded
+my $rth = $dbh->prepare("select dhtkeyuid from queries where
trialuid=$trialuid and querytype = 2 and succeeded = 1");
+$rth->execute();
+
+%put_replica_hash = {};
+$put_replica_average = 0;
+$put_replicas = 0;
+while($data = $rth->fetchrow_hashref())
+{
+ if (exists $put_replica_hash{$$data{'dhtkeyuid'}})
+ {
+ $put_replica_hash{$$data{'dhtkeyuid'}} =
$put_replica_hash{$$data{'dhtkeyuid'}} + 1;
+ }
+ else
+ {
+ $put_replica_hash{$$data{'dhtkeyuid'}} = 1;
+ }
+}
+
+foreach $key (keys(%put_replica_hash))
+{
+ $put_replicas += $put_replica_hash{$key};
+}
+$put_replicas_average = int(($put_replicas/$num_puts_succeeded) * 100) / 100;
+
+#Select for number of gets initiated
+my $rth = $dbh->prepare("select count(*) from queries where trialuid=$trialuid
and querytype = 1 and succeeded = 0 and hops = 0 and dhtkeyuid <> 0");
+$num_gets = getCount($rth);
+
+
+#Select for number of gets that hit data
+my $rth = $dbh->prepare("select count(distinct dhtqueryid) from queries where
trialuid=$trialuid and querytype = 1 and succeeded = 1");
+$num_gets_succeeded = getCount($rth);
+$num_gets_failed = $num_gets - $num_gets_succeeded;
+
+
+if ($num_gets > 0)
+{
+ $percent_gets_succeeded = int(100 * ($num_gets_succeeded/$num_gets))/100;
+}
+else
+{
+ $percent_gets_succeeded = 0;
+}
+
+#Select for all gets that succeeded
+my $rth = $dbh->prepare("select dhtqueryid from queries where
trialuid=$trialuid and querytype = 1 and succeeded = 1");
+$rth->execute();
+
+%get_replica_hash = {};
+$get_replica_average = 0;
+$get_replicas = 0;
+while($data = $rth->fetchrow_hashref())
+{
+ if (exists $get_replica_hash{$$data{'dhtqueryid'}})
+ {
+ $get_replica_hash{$$data{'dhtqueryid'}} =
$get_replica_hash{$$data{'dhtqueryid'}} + 1;
+ }
+ else
+ {
+ $get_replica_hash{$$data{'dhtqueryid'}} = 1;
+ }
+}
+
+foreach $key (keys(%get_replica_hash))
+{
+ $get_replicas += $get_replica_hash{$key};
+}
+$get_replicas_average = int(($get_replicas/$num_gets_succeeded) * 100) / 100;
+
+
+#Select for number of malicious gets initiated
+my $rth = $dbh->prepare("select count(*) from queries where trialuid=$trialuid
and querytype = 1 and succeeded = 0 and hops = 0 and dhtkeyuid = 0");
+$num_malicious_gets = getCount($rth);
+
+
+
+#Select for number of replies started
+my $rth = $dbh->prepare("SELECT count(distinct dhtqueryid) FROM `queries`
where trialuid = $trialuid and querytype = 3 and succeeded = 0 and hops = 0");
+$num_replies = getCount($rth);
+
+#Select for number of replies that succeeded
+my $rth = $dbh->prepare("SELECT count(distinct dhtqueryid) FROM `queries`
where trialuid = $trialuid and querytype = 3 and succeeded = 1");
+$num_replies_succeeded = getCount($rth);
+$num_replies_failed = $num_replies - $num_replies_succeeded;
+
+if ($num_replies > 0)
+{
+ $percent_replies_succeeded = int(100 * ($num_replies_succeeded /
$num_replies))/100;
+}
+else
+{
+ $percent_replies_succeeded = 0;
+}
+
+
+print <<ENDHTML;
+<h2>Trial Statistics</h2>
+<table align=center border=1 padding=1>
+ <tr>
+ <td><b>Stat</b></td>
+ <td><b>Attempts</b></td>
+ <td><b>Successful</b></td>
+ <td><b>Failed</b></td>
+ <td class="inner"><b>Success Rate</b></td>
+ <td><b>Average</br>Replicas</b></td>
+ </tr>
+ <tr>
+ <td><b>Items Inserted</b></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=2">$num_puts</a></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=2&succeeded=1">$num_puts_succeeded</a></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=2&succeeded=0">$num_puts_failed</a></td>
+ <td class="inner">$percent_puts_succeeded</td>
+ <td class="inner">$put_replicas_average</td>
+ </tr>
+ <tr>
+ <td><b>Items Searched</b></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=1">$num_gets</a></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=1&succeeded=1">$num_gets_succeeded</a></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=1&succeeded=0">$num_gets_failed</a></td>
+ <td class="inner">$percent_gets_succeeded</td>
+ <td class="inner">$get_replicas_average</td>
+ </tr>
+ <tr>
+ <td><b>Replies</b></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=3">$num_replies</a></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=3&succeeded=1">$num_replies_succeeded</a></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=3&succeeded=0">$num_replies_failed</a></td>
+ <td class="inner">$percent_replies_succeeded</td>
+ </tr>
+</table>
+ENDHTML
+
+print <<ENDHTML;
+<h2>Malicious Message Statistics</h2>
+<table align=center border=1 padding=1>
+ <tr>
+ <td><b>Malicious Gets</b></td>
+ <td><b>Malicious Puts</b></td>
+ </tr>
+ <tr>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=2&succeeded=1">$num_malicious_gets</a></td>
+ <td class="inner"><a
href="queries.cgi?trialuid=$trialuid&querytype=2&succeeded=0">$num_malicious_puts</a></td>
+ </tr>
+</table>
+ENDHTML
+
+#Select for number of gets initiated
+my $rth = $dbh->prepare("select * from queries where trialuid=$trialuid and
querytype = 2 and succeeded = 0 and hops = 0");
+$rth->execute();
+
+my $rth = $dbh->prepare("SELECT * FROM `queries` where trialuid = $trialuid
and querytype = 3 and succeeded = 0 and hops = 0");
+$rth->execute();
+
+#Select for average hopcount for successful gets
+my $rth = $dbh->prepare("SELECT avg(hops) FROM `queries` where trialuid =
$trialuid and querytype = 1 and succeeded = 1");
+$avg_get_hops = int(getCount($rth) * 100)/100;
+
+#Select for average hopcount for successful puts
+my $rth = $dbh->prepare("SELECT avg(hops) FROM `queries` where trialuid =
$trialuid and querytype = 2 and succeeded = 1");
+$avg_put_hops = int(getCount($rth) * 100)/100;
+
+#Select for average hopcount for successful replies
+my $rth = $dbh->prepare("SELECT avg(hops) FROM `queries` where trialuid =
$trialuid and querytype = 3 and succeeded = 1");
+$avg_reply_hops = int(getCount($rth) * 100)/100;
+
+#Select for max hopcount for successful gets
+my $rth = $dbh->prepare("SELECT max(hops) FROM `queries` where trialuid =
$trialuid and querytype = 1 and succeeded = 1");
+$max_get_hops = getCount($rth);
+
+#Select for max hopcount for successful puts
+my $rth = $dbh->prepare("SELECT max(hops) FROM `queries` where trialuid =
$trialuid and querytype = 2 and succeeded = 1");
+$max_put_hops = getCount($rth);
+
+#Select for max hopcount for successful replies
+my $rth = $dbh->prepare("SELECT max(hops) FROM `queries` where trialuid =
$trialuid and querytype = 3 and succeeded = 1");
+$max_reply_hops = getCount($rth);
+
+print <<ENDHTML;
+<h2>Efficiency Statistics</h2>
+<table align=center border=1>
+<tr>
+<td><b>Stat</b></td><td class="inner"><b>Average
Hops<br/>(successful)</b></td><td class="inner"><b>Max
hops<br/>(successful)</b></td>
+</tr>
+<tr>
+<td><b>Items Inserted</b></td><td class="inner">$avg_put_hops</td><td
class="inner">$max_put_hops</td>
+</tr>
+<tr>
+<td><b>Items Searched</b></td><td class="inner">$avg_get_hops</td><td
class="inner">$max_get_hops</td>
+</tr>
+<tr>
+<td><b>Replies</b></td><td class="inner">$avg_reply_hops</td><td
class="inner">$max_reply_hops</td>
+</tr>
+</table>
+ENDHTML
+
+print "<h3>Latex</h3>\n";
+my $topology_int = $$data{'topology'};
+print "& $topology & $numNodes & $averageConnections
($logNMultiplier lnN) & $percent_puts_succeeded &
$percent_gets_succeeded & $percent_replies_succeeded & $avg_put_hops
& $avg_get_hops & $avg_reply_hops \\\\\n";
+
+print("</body>\n</html>\n");
+
+
+sub getCount
+{
+ my $new_rth = shift;
+ $new_rth->execute();
+ my @data = $new_rth->fetchrow_array();
+ return $data[0];
+}
\ No newline at end of file
Added: GNUnet/contrib/profiling/trialsToRun.cgi
===================================================================
--- GNUnet/contrib/profiling/trialsToRun.cgi (rev 0)
+++ GNUnet/contrib/profiling/trialsToRun.cgi 2009-08-28 18:06:15 UTC (rev
8867)
@@ -0,0 +1,132 @@
+#!/usr/bin/perl
+use DBD::mysql;
+use CGI;
+require "/var/www/localhost/htdocs/dht/serverConf.pl";
+my $c = new CGI;
+$c->header;
+
+$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+$dbh = DBI->connect($dsn, $user, $password);
+%topologies = (0 => "Clique", 1 => "Small World", 2 => "Ring", 3 =>
"2d-Torus", 4 => "Erdos-Renyi", 5 => "InterNAT");
+$numnodes = 0;
+$numnodes = $c->param("numnodes");
+$errors = "";
+$sqlinsert = "";
+if ($numnodes > 0)
+{
+ my $puts = $c->param("puts");
+ my $gets = $c->param("gets");
+ my $topology_modifier = $c->param("topology_modifier");
+ my $logNMultiplier = $c->param("logNMultiplier");
+ my $topology = $c->param("topology");
+ my $concurrent = $c->param("concurrent");
+ my $settle_time = $c->param("settle_time");
+ my $malicious_droppers = $c->param("malicious_droppers");
+ my $malicious_getters = $c->param("malicious_getters");
+ my $malicious_putters = $c->param("malicious_putters");
+ my $malicious_get_frequency = $c->param("malicious_get_frequency");
+ my $malicious_put_frequency = $c->param("malicious_put_frequency");
+ my $message = $c->param("message");
+ $sqlinsert = "insert into trialsToRun (numnodes, concurrent, settle_time,
puts, gets, topology, topology_modifier, logNMultiplier, malicious_getters,
malicious_get_frequency, malicious_putters, malicious_put_frequency,
malicious_droppers, message) values (\'$numnodes\', \'$concurrent\',
\'$settle_time\', \'$puts\', \'$gets\', \'$topology\', \'$topology_modifier\',
\'$logNMultiplier\', \'$malicious_getters\', \'$malicious_get_frequency\',
\'$malicious_putters\', \'$malicious_put_frequency\', \'$malicious_droppers\',
\'$message\')";
+ my $rth = $dbh->prepare($sqlinsert);
+ $rth->execute();
+
+ $errors = $dbh->errstr() . $rth->errstr();
+}
+print <<ENDHTML;
+<html>
+<head>
+<title>Trial Scheduler</title>
+<style>
+td {color:black;font-family:verdana}
+a {color:black}
+h2 {color:black;font-family:verdana}
+td { padding-top: 1px;padding-bottom: 1px;padding-left: 4px;padding-right:
4px; text-align:center}
+td.inner {text-align:center}
+
+</style>
+</head>
+
+<body id="body" bgcolor=beige style="text-align:center">
+<br/>
+<h2>Trial $numnodes Info</h2>
+<h4>$errors</h4>
+<br/>
+ <table border="1" align=center>
+ <tr>
+ <td><b>Trial ID</b></td>
+ <td><b># Nodes</b></td>
+ <td><b>Topology</b></td>
+ <td><b>Modifier</b></td>
+ <td><b>LogN Multiplier</b></td>
+ <td><b># Puts</b></td>
+ <td><b>#Gets</b></td>
+ <td><b>Concurrency</b></td>
+ <td><b>Settle</b></td>
+ <td><b>Malicious Getters</b></td>
+ <td><b>Malicious Get Frequency</b></td>
+ <td><b>Malicious Putters</b></td>
+ <td><b>Malicious Put Frequency</b></td>
+ <td><b>Malicious Droppers</b></td>
+ <td><b>Message</b></td>
+ </tr>
+
+ENDHTML
+
+my $rth = $dbh->prepare("select * from trialsToRun order by trialuid");
+$rth->execute();
+
+while($data = $rth->fetchrow_hashref())
+{
+ my $table_line = "<tr><td class=\"inner\">$$data{'trialuid'}</td><td
class=\"inner\">$$data{'numnodes'}</td>
+ <td class=\"inner\">$topologies{$$data{'topology'}}</td>
+ <td class=\"inner\">$$data{'topology_modifier'}</td>
+ <td class=\"inner\">$$data{'logNMultiplier'}</td>
+ <td class=\"inner\">$$data{'puts'}</td>
+ <td>$$data{'gets'}</td>
+ <td class=\"inner\">$$data{'concurrent'}</td>
+ <td class=\"inner\">$$data{'settle_time'}</td>
+ <td class=\"inner\">$$data{'malicious_getters'}</td>
+ <td class=\"inner\">$$data{'malicious_get_frequency'}</td>
+ <td class=\"inner\">$$data{'malicious_putters'}</td>
+ <td class=\"inner\">$$data{'malicious_put_frequency'}</td>
+ <td class=\"inner\">$$data{'malicious_droppers'}</td>
+ <td class=\"inner\">$$data{'message'}</td></tr>";
+ print $table_line . "\n";
+}
+print <<ENDHTML;
+<form name="add_row" type=get>
+ <tr>
+ <td>----</td><td><input size=3 type="text"
name="numnodes"/></td><td><select name="topology">
+ENDHTML
+ foreach $key (keys(%topologies))
+ {
+ if ($key == 1)
+ {
+ print("<option value=$key selected>$topologies{$key}</option>");
+ }
+ else
+ {
+ print("<option value=$key>$topologies{$key}</option>");
+ }
+ }
+print <<ENDHTML;
+ </select></td>
+ <td><input size=4 type="text" name="topology_modifier"</td>
+ <td><input size=4 type="text" name="logNMultiplier"</td>
+ <td><input size=5 type="text" name="puts" /></td>
+ <td><input size=5 type="text" name="gets"/></td>
+ <td><input size=3 type="text" name="concurrent" /></td>
+ <td><input size=3 type="text" name="settle_time"/></td>
+ <td><input size=3 type="text" name="malicious_getters"/></td>
+ <td><input size=3 type="text" name="malicious_get_frequency"/></td>
+ <td><input size=3 type="text" name="malicious_putters"/></td>
+ <td><input size=3 type="text" name="malicious_put_frequency"/></td>
+ <td><input size=3 type="text" name="malicious_droppers"/></td>
+ <td><input type="text" name="message"/></td>
+ </tr>
+ <tr><td colspan=14 class="inner"><input type="submit" value="Add Trial"
/></td></tr>
+</form>
+ENDHTML
+print("</table>\n");
+print("</body>\n</html>\n");
\ No newline at end of file
Property changes on: GNUnet/contrib/profiling/trialsToRun.cgi
___________________________________________________________________
Added: svn:executable
+ *
Added: GNUnet/contrib/profiling/welcome.cgi
===================================================================
--- GNUnet/contrib/profiling/welcome.cgi (rev 0)
+++ GNUnet/contrib/profiling/welcome.cgi 2009-08-28 18:06:15 UTC (rev
8867)
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+use DBD::mysql;
+require "/var/www/localhost/htdocs/dht/serverConf.pl";
+print "Content-Type: text/html\n\n";
+
+$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+$dbh = DBI->connect($dsn, $user, $password);
+%topologies = (0 => "Clique", 1 => "Small World", 2 => "Ring", 3 =>
"2d-Torus", 4 => "Erdos-Renyi", 5 => "InterNAT");
+print <<ENDHTML;
+<html>
+<head>
+<title>DHT Testing Trial Page</title>
+<style>
+td {color:black;font-family:verdana;text-align:center}
+a {color:black}
+div {color:black;font-family:verdana}
+</style>
+</head>
+
+<body id="body" bgcolor=beige style="text-align:center">
+<br/>
+<div><font size=+3>Trial List</font></div>
+<br/>
+ <table border="1" align=center>
+ <tr>
+ <td><b>Trial ID</b></td>
+ <td><b># Nodes</b></td>
+ <td><b>Topology</b></td>
+ <td class="inner"><b>Topology<br/>Modifier</b></td>
+ <td class="inner"><b>Log<br/>Multiplier</b></td>
+ <td><b># Puts</b></td>
+ <td><b>#Gets</b></td>
+ <td><b>Concurrent<br/>Requests</b></td>
+ <td><b>Settle<br/>Time</b></td>
+ <td><b>Total<br/>Connections</b></td>
+ <td><b>Malicious<br/>Getters</b></td>
+ <td><b>Malicious<br/>Putters</b></td>
+ <td><b>Malicious<br/>Droppers</b></td>
+ <td><b>Trial<br/>Comment</b></td>
+ </tr>
+
+ENDHTML
+
+my $rth = $dbh->prepare("select * from trials where endtime > '0/00/0000'
order by trialuid desc");
+$rth->execute();
+
+while($data = $rth->fetchrow_hashref())
+{
+ my $topology_int = $$data{'topology'};
+ my $table_line = "<tr>
+ <td><a
href=\"trial.cgi?trialuid=$$data{'trialuid'}\">$$data{'trialuid'}</a></td>
+ <td>$$data{'numnodes'}</td>
+ <td>$topologies{$topology_int}</td>
+ <td class=\"inner\">$$data{'topology_modifier'}</td>
+ <td class=\"inner\">$$data{'logNMultiplier'}</td>
+ <td>$$data{'puts'}</td>
+ <td>$$data{'gets'}</td>
+ <td>$$data{'concurrent'}</td>
+ <td>$$data{'settle_time'}</td>
+ <td>$$data{'totalConnections'}</td>
+ <td>$$data{'malicious_getters'}</td>
+ <td>$$data{'malicious_putters'}</td>
+ <td>$$data{'malicious_droppers'}</td>
+ <td>$$data{'message'}</td>
+ </tr>";
+ print $table_line . "\n";
+}
+print("</table>\n");
+print("</body>\n</html>\n");
Property changes on: GNUnet/contrib/profiling/welcome.cgi
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8867 - in GNUnet/contrib: . profiling,
gnunet <=