Changeset 27512 for gs2-extensions


Ignore:
Timestamp:
2013-05-30T10:16:22+12:00 (11 years ago)
Author:
jmt12
Message:

Adding in a special test for measuring the effect of altering ThriftFS buffer size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/bin/script/test_fileutils.pl

    r27481 r27512  
    6767# populate globals
    6868$base_path = $ENV{'GEXTPARALLELBUILDING'};
     69
     70# SPECIAL TESTS
     71if (defined $ARGV[0])
     72{
     73  if ($ARGV[0] eq "-buffersize")
     74  {
     75    print STDERR "Exploring the affect of ThriftBuffer size on transfer speed\n";
     76    my $filename = 'WekaManual-3-6-7.pdf';
     77    my $local_path = $base_path . '/resources/' . $filename;
     78    my $thrift_path = 'HDThriftFS:///user/' . $user. '/' . $filename;
     79    my $tmp_path = '/tmp/' . $filename;
     80    print STDERR " - copying " . $filename . " (" . &FileUtils::fileSize($local_path) . " bytes)\n";
     81    $start_time = time();
     82    print STDERR " - copy to Thrift... ";
     83    &FileUtils::copyFiles($local_path, $thrift_path);
     84    print STDERR "Done in " . (time() - $start_time) . " seconds\n";
     85    $start_time = time();
     86    print STDERR " - copy from Thrift...";
     87    &FileUtils::copyFiles($thrift_path, $tmp_path);
     88    print STDERR "Done in " . (time() - $start_time) . " seconds\n";
     89    my $result = `diff "$local_path" "$tmp_path"`;
     90    $test_count = 0;
     91    &testAction(\$test_count, "Comparing binary files (roundtrip)", '', $result);
     92    &FileUtils::removeFiles($thrift_path);
     93    &FileUtils::removeFiles($tmp_path);
     94    exit;
     95  }
     96}
    6997
    7098print "\n";
     
    261289sub testBinaryTransfer
    262290{
    263   my ($dir, $base_dir) = @_;
     291  my ($dir, $base_dir, $file) = @_;
     292  if (!defined $file)
     293  {
     294    $file = 'aurora_australus.jpg';
     295  }
    264296  # setup
    265   my $local_image_path = $base_path . '/resources/aurora_australus.jpg';
    266   my $thrift_copy_path = $dir . '/test_binary_transfer.jpg';
    267   my $local_copy_path = '/tmp/test_binary_transfer.jpg';
     297  my ($extension) = $file =~ /\.([^\.]+)$/;
     298  my $local_image_path = $base_path . '/resources/' . $file;
     299  my $thrift_copy_path = $dir . '/test_binary_transfer.' . $extension;
     300  my $local_copy_path = '/tmp/test_binary_transfer.' . $extension;
    268301  # actions - roundtrip copy of files
    269302  &FileUtils::copyFiles($local_image_path, $thrift_copy_path);
Note: See TracChangeset for help on using the changeset viewer.