tor-stress 659 B

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