blob: ac82973aa34ea3d6dc7743e2da86d1f2d2df8364 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/perl
require 'sys/syscall.ph';
use POSIX qw(strftime);
$|=1;
$total = 1;
for($i=0;$i<$total;$i++) {
print "Starting client $i\n";
$pid = fork();
if(!$pid) {
open(FD,"wget -q -O - http://www.cnn.com/|");
$c = 0;
while(<FD>) {
$c += length($_);
}
($s, $usec) = gettimeofday;
$TIMEVAL_T = "LL";
$now = pack($TIMEVAL_T, ());
syscall(&SYS_gettimeofday, $now, 0) != -1 or die "gettimeofday: $!";
@now = unpack($TIMEVAL_T, $now);
# $now_string = strftime "%b %d %H:%M:%S", gmtime;
# $now_string .= $now[1]/1000;
print "Client $i exiting ($c chars: $now[1]).\n";
exit(0);
}
# sleep(1);
}
|