#!/usr/bin/perl
# testcs.pl by Edward Chow, 2/3/2001
#

use LWP::Simple;
use Time::HiRes qw(usleep gettimeofday tv_interval);

for ($i=1; $i<2; $i++) {
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_10k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_11k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_12k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_13k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_14k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_15k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_16k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_17k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_18k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_19k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_20k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_21k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_29k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_33k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_45k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI__get.xls');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_50k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_64k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_85k.htm');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_100k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_115k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_200k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_400k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_500k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_529k.ex');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_1000k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_1500k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_2000k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_2500k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_3000k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_3500k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_4000k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_4500k.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/GANDALF_5m.html');
sleep(1);
timeGetUrl ('http://fladnag.uccs.edu/~cs622/test1/VINCI_5500k.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\n";

#        $time2 = time;
#        $period = $time2 - $time1;
#        print "get $url size $length in $period seconds\n";
}
