Changes between Version 25 and Version 26 of Tutorials/a0Basic/Tutorial3


Ignore:
Timestamp:
Sep 30, 2014, 1:03:35 AM (10 years ago)
Author:
seskar
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/a0Basic/Tutorial3

    v25 v26  
    33[[TOC(Tutorials/a0Basic*)]]
    44
    5 It is important to understand how measurements were collected and organized to be able to interpret them. The [wiki:Documentation/OML ORBIT Measurement Framework] provides tools to insert points to tap available information and to effectively collect that information in a timely manner. The [wiki:Software/dOML/CollectingMeasurements previous part] of this tutorial presented information about defining and setting up this information collection points. The collected information and measurements are then stored in a [http://www.mysql.com MySQL] database.
     5It is important to understand how measurements were collected and organized to be able to interpret them. The [wiki:Documentation/OML ORBIT Measurement Framework] provides tools to insert points to tap available information and to effectively collect that information in a timely manner. The [wiki:Software/dOML/CollectingMeasurements previous part] of this tutorial presented information about defining and setting up this information collection points. The collected information and measurements are then stored in a [http://www.mysql.com SQLite] database.
    66
    77After the experiment completion, the user have access to the generated experiment database. In general, the results of a given experiment are stored in a single database (users can use more than one databases if required). Different participating nodes populate different tables of this generated database. Usually, user would like to post-process or visualize those raw measurements for further analysis.
     
    99A number of different tools are available to interpret experimental results.  The choice of tools depends upon their availability on your platform, the nature of the measurements, and your own preferences. Excel and Matlab connections from  machines outside Winlab to our database server are blocked by a firewall.  We are working on a system to safely and securely export databases using these tools outside Winlab.  Until then, please use any of the other following approaches to retrieve your data.
    1010
    11 ''Note:  Currently all databases share the same credentials'' - '''Username and Password: orbit'''
     11=== Using Result Service ===
    1212
    13 [[BR]]
    14 == 1. Using MySQL Client ==
     13=== Using Direct Database Access ===
    1514
    16 The easiest way to access your data is by manipulating the database directly with the MySQL Client. From a terminal session on ''gateway.orbit-lab.org'' (or any of the consoles), you may access your database by issuing the following commands from the command line:
     15=== Microsoft Excel Example ===
    1716
    18 {{{
    19 $ mysql -h idb1 -u orbit -p
    20 Enter password:
    21 Welcome to the MySQL monitor.  Commands end with ; or \g.
    22 Your MySQL connection id is 153 to server version: 4.1.15-Debian_1-log
    2317
    24 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    25 
    26 mysql> use   <DB NAME>;
    27 
    28 }}}
    29 
    30 Standard MySQL queries can then be made to manipulate your data.  A brief tutorial on how to use MySQL can be found [http://dev.mysql.com/doc/refman/4.1/en/index.html here].
    31 
    32 The database name is your experiment ID and is displayed by the nodehandler in the first few lines of your experiment run.  It will look something like this:
    33 {{{
    34  INFO init: Experiment ID: sb5_2006_01_17_11_45_23
    35 }}}
    36 
    37 [[BR]]
    38 == 2. Using Perl scripts ==
    39 
    40 You can use the following sample Perl script to retrieve the content of a particular table from your experiment database:
    41 {{{
    42 #! /usr/bin/perl
    43 #
    44 # Script: getdata.pl
    45 # A simple script that gets all the rows from a single table in the database.
    46 #
    47 # ./getdata.pl <db_name> <table_name> <outputfile>
    48 #
    49 # Example: ./getdata.pl zmac1_2005_04_28_00_46_10  sender_otg_senderport  out.txt
    50 #
    51 # To use this script replace the XXXX in DBUSER and DBPASS
    52 # with correct username and password for idb1.
    53 #
    54 #
    55 use DBI();
    56 
    57 $DBHOST = "idb1";
    58 $DBNAME = $ARGV[0];
    59 $DBUSER = "XXXX";
    60 $DBPASS = "XXXX";
    61 $QUERY = "select * from $ARGV[1]";
    62 $OUTFILE = $ARGV[2];
    63 
    64 $dsn = "DBI:mysql:database=$DBNAME;host=$DBHOST";
    65 
    66 #Connect to the DB
    67 $dbh = DBI->connect($dsn, $DBUSER, $DBPASS, {'RaiseError' => 1});
    68 
    69 # Prepare and execute query
    70 my $qry = $dbh->prepare($QUERY);
    71 $qry->execute();
    72 
    73 open(out, ">$OUTFILE");
    74 
    75 #Print the column names
    76 print out "@{$qry->{'NAME'}} \n";
    77 
    78 #Print the data
    79 while (my @ref = $qry->fetchrow()) {
    80         print out "@ref \n";
    81 }
    82 
    83 $qry->finish();
    84 # Disconnect from the database.
    85 $dbh->disconnect();
    86 }}}
    87 
    88 A more specific Perl script for OTG/OTR application can be found [wiki:Old/Documentation/OTG/Measurement/DatabaseProcess here]
    89 
    90 [[BR]]
    91 == 3. Using Microsoft Excel ==
    92 
    93 Microsoft Excel can be used to analyze an experiment as shown below.
    94 
    95 [[Image(Excelexample.PNG)]]
    96 
    97 The user could import MySQL database to Microsoft Excel and use chart and other tools to analyze the measurements.
    98 
    99 [[BR]]
    100 == 4. Using Matlab ==
    101 
    102 Matlab is another tool can be used.  It should be noted that this assumes you have [http://www.die.net/doc/linux/man/man1/mysqldump.1.html exported] the database off of ORBIT and imported to your own MySQL server.
    103 {{{
    104 function nsf(dbServer, dbUser, dbPW, database);
    105 % Part where we retrieve data from the database;
    106 mysql('open',dbServer, dbUser, dbPW);
    107 mysql('use', database);
    108 output = struct('time',[],'thr_all',[],'node',[]);
    109 [output.time, output.thr_all, output.node] = mysql('select timestamp, throughput, node_id from group2');
    110 [thru1_4, time1_4, thru3_1, time3_1] = sort_mysql(output);
    111 % Finally, the plotting part
    112 subplot(2,1,1);
    113 plot(time1_4, thru1_4, '-*');
    114 title('Throughput On Obstructed Link');
    115 xlabel('Time (sec)'); ylabel('Throuhput (bps)'); grid on;
    116 subplot(2,1,2);
    117 plot(time3_1, thru3_1, '-*');
    118 title('Throughput On Monitor Node'); xlabel('Time (sec)');
    119 ylabel('Throuhput (bps)'); grid on;
    120 }}}
    121 
    122 And the resulting graph is show below:
    123 
    124 [[Image(Matlabexample.PNG)]]
     18=== Matlab Example ===