943,708 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 1011
  • Perl RSS
Jun 28th, 2009
0

Simple Benchmark script

Expand Post »
Hello all,

I have been working with Linux a lot and i find myself installing a lot of linux distros, but with no way to test them.....

So i crafted a script in Perl to quickly create a lot of files on the Hard Disk and delete them. The script will count the number of milliseconds it took from start till deletion of all the files....

For example, on my home pc, with IDE Drives, it took ~800ms, on my laptop (SATA) ~200ms and on an old pentium 1.4ghz, fresh install - ~400ms

Perl Syntax (Toggle Plain Text)
  1. use Time::HiRes qw[gettimeofday tv_interval];
  2. use File::Path;
  3. if (-e "test")
  4. {
  5. system("rm -rf test");
  6. }
  7. $timedata = [gettimeofday()];
  8. mkdir "test" or die $!;
  9. chdir "test" or die $!;
  10. my $num = 1;
  11. while ($num != 6000)
  12. {
  13. $num = $num + 1;
  14. open FILE, ">", "$num.txt" or die $!;
  15. }
  16. system("rm -rf test");
  17. my $duration = tv_interval($timedata) * 1000;
  18. print "$duration Milliseconds";
  19. print "\n";


any comments are mostly welcomed!
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster
Mahen is offline Offline
144 posts
since Aug 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: Compare 2 tables
Next Thread in Perl Forum Timeline: Perl Newby Question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC