GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEST::PARSER::IOZONE (3)

.ds Aq ’

NAME

Test::Parser::iozone - Perl module to parse output from iozone.

CONTENTS

SYNOPSIS



 use Test::Parser::iozone;

 my $parser = new Test::Parser::iozone;
 $parser->parse($text);



DESCRIPTION

This module transforms iozone output into a hash that can be used to generate XML.

FUNCTIONS

Also see Test::Parser for functions available from the base class.

new()

Creates a new Test::Parser::iozone instance. Also calls the Test::Parser base class’ new() routine. Takes no arguments.

data()

Returns a hash representation of the iozone data.

Override of Test::Parser’s default parse_line() routine to make it able to parse iozone output.

plot_2d()

Plot the data using Gnuplot.

commented_out

FIXME: This will eventually be supported through the Test::Presenter method
to_plot(). When this method has been written, most of this can be thrown out

sub plot_2d {
my $self = shift;



    my %gopts;
    $gopts{defaults} = {
        title => iozone Performance,
#        yrange => [0:],
        x-axis label => Record size (kb),
        y-axis label => File size (kb),
#        extra_opts => set grid xtics ytics,
#        output type => "$self->{format}",
        output file => "$self->{outdir}/iozone-",
    };

    my %data_opts = ( title => ,
                      style => lines,
                      type  => columns ,
                      );

    # TODO:  Were just taking a snapshot at 32 byte record lengths
    #        We should either take this as an input, or provide a
    #        3D plotting capability
    my $reclen = 32;
    my @x_columns;
    my %y_columns;
    foreach my $d (@{$self->{data}}) {
        next unless ($d->{reclen} == $reclen);
        push @x_columns, $d->{KB};
        foreach my $key (keys %{$d}) {
            next unless (defined $d->{$key});
            push @{$y_columns{$key}}, $d->{$key};
        }
    }

    print "Number of X points (should be about 10-20):",
    scalar @x_columns, "\n";

    #
    # Generate charts.
    #
    foreach my $h (IOZONE_HEADERS) {
        # Skip x-columns
        next if ($h =~ /^kb$/i
                 or $h =~ /^reclen$/i);

        %{$gopts{$h}} = %{$gopts{defaults}};
        $gopts{$h}->{title} .= " - $h";
        $gopts{$h}->{output file} .=  "$h.$self->{format}";

        if (defined $y_columns{$h} ) {
            print "plotting $h\n";
            gnuplot( $gopts{$h}, [\%data_opts, \@x_columns, $y_columns{$h}] );
        }
    }
}



commented_out

FIXME: This will eventually be supported through the Test::Presenter method
to_plot(). When this method has been written, most of this can be thrown out

# This is a static function for plotting multiple runs # with a date or software version as the X-Axis sub historical_plot {
my $runs = shift || return undef;
my $file_sizes = shift || return undef;
my $reclens = shift || return undef;



    my $format = $runs->[0]->{format};
    my $outdir = $runs->[0]->{outdir};

    # Graph options
    my %gopts_defaults =
        (
         title => Historical iozone Performance,
         x-axis label => Time,
         y-axis label => KB/sec,
         yrange       => [0:],
         xdata        => time,
         timefmt      => %b:%d:%H:%M:%S:%Y,
         format       => [y, %.0f],

         output file  => "$outdir/iozone-",
#         extra_opts   => set grid,
         );

    # Data-set default options
    my %data_opts =
        (
          title => ,
          style => lines,
          type  => matrix,
           );

    if (@{$runs} < 1) {
        warn "No data to graph\n";
        return undef;
    }
   
    if (@{$file_sizes} == 1) {
        # Put file_size into title
        $gopts_defaults{title} =
            join(" - ", $gopts_defaults{title}, "$file_sizes->[0] kb files");
    }

    if (@{$reclens} == 1) {
        # Put reclen into title
        $gopts_defaults{title} =
            join(" - ", $gopts_defaults{title}, "$reclens->[0] kb records");
    }

    # Transform the list of runs into data matrices indexed by column name
    my %data = _runs_to_data($runs, $file_sizes, $reclens);
    if (values %data < 1) {
        warn "Error:  Could not transform data\n";
        return undef;
    }

    # Create a plot for each of the iozone fields with data defined
    foreach my $h (IOZONE_HEADERS) {
        # Skip x-columns
        next if ($h =~ /^kb$/i
                 or $h =~ /^reclen$/i);

        my %gopts = %gopts_defaults;
        $gopts{output file} .=  "$h.$format";

        if ( $data{$h} ) {
            my @data_sets;
            foreach my $file_size (@{$file_sizes}) {
                foreach my $reclen (@{$reclens}) {
                    my %opts = %data_opts;
                    if (@{$file_sizes} > 1) {
                        $opts{title} .= " - $file_size kb files";
                    }
                    if (@{$reclens} > 1) {
                        $opts{title} .= " - $reclen kb records";
                    }
                    push @data_sets, [\%opts, $data{$h}->{$file_size}->{$reclen}];
                }
            }
            print "plotting $h\n";
            gnuplot(\%gopts, @data_sets );
        }
    }



}

# This is a static function to compare several runs sub comparison_plot {
my $runs = shift || return undef;
my $names = shift || return undef;



    my $num_runs = @{$runs};
    my $num_names = @{$names};

    if ($num_runs != $num_names) {
        warn "$num_runs runs and $num_names provided.\n";
        warn "Error:  Must specify a name for each run\n";
        return undef;
    }

    if ($num_runs < 2) {
        warn "Error:  Need at least 2 runs to do comparison plot\n";
        return undef;
    }

    my $format = $runs->[0]->{format};
    my $outdir = $runs->[0]->{outdir};

    # Graph options
    my %gopts =
        (
         title        => iozone Performance Comparison,
         x-axis label => Record size (kb),
         y-axis label => File size (kb),
         output file  => "$outdir/iozone-",
         );

    # Transform the list of runs into data matrixes indexed by column name
    my %data;
    my $reclen = 32;
    foreach my $run (@{$runs}) {
        my $name = shift @{$names};
        my %data_opts = (
                      title => $name,
                      style => lines,
                      type  => columns,
                      );

        # Extract the data out of hashes and put into columns
        my @x_column;
        my %y_columns;
        foreach my $d ($run->{data}) {
            next unless ($d->{reclen} == $reclen);
            push @x_column, $d->{KB};

            foreach my $key (keys %{$d}) {
                push @{$y_columns{$key}}, $d->{$key};
            }
        }

        # Put the columns
        foreach my $key (keys %y_columns) {
            push @{$data{$key}}, [\%data_opts, \@x_column, $y_columns{$key}];
        }
    }       

    # Create a plot for each of the iozone fields with data defined
    foreach my $h (IOZONE_HEADERS) {
        # Set the global options
        %{$gopts{$h}} = %{$gopts{defaults}};
        $gopts{$h}->{title} .= " - $h";
        $gopts{$h}->{output file} .=  "$h.$format";

        if (defined $gopts{$h} && defined $data{$h}) {
            print "plotting $h\n";
            gnuplot($gopts{$h}, @{$data{$h}});
        }
    }



}

AUTHOR

Bryce Harrington <bryce@osdl.org>

COPYRIGHT

Copyright (C) 2006 Bryce Harrington & Open Source Development Labs, Inc. All Rights Reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Test::Parser

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 536: ’=end’ without a target?
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEST::PARSER::IOZONE (3) 2008-02-27

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.