#!/usr/bin/perl
# testcs.pl by Edward Chow, 2/3/2001
#

use LWP::Simple;
use Time::HiRes qw(usleep gettimeofday tv_interval);

$count = 0;


for ($i=1; $i<2; $i++) {
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1); $count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1); $count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count +=1;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1); $count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
sleep(1);$count ++;
timeGetUrl ('http://wait.uccs.edu:8080/ayeddula/esi/testesi.html');
}

sub timeGetUrl() {
        my ($url) = @_;

   my $s1;
   my $usec1;
   my $s2;
   my $usec2;
   my $time_diff;

#        $time1 = time;

   ($s1, $usec1) = gettimeofday;

         $doc = get $url;

   ($s2, $usec2) = gettimeofday;
  
         $length= length  $doc;

   $time_diff = ($s2 - $s1) * 1000000 + ($usec2 - $usec1);

        print "get $url size $length in $time_diff microseconds count $count \n";

#        $time2 = time;
#        $period = $time2 - $time1;
#        print "get $url size $length in $period seconds\n";
}

