Test::Parser::Dbench - Perl module to parse output from Dbench


Test-Parser documentation Contained in the Test-Parser distribution.

Index


Code Index:

NAME

Top

Test::Parser::Dbench - Perl module to parse output from Dbench

SYNOPSIS

Top

    use Test::Parser::Dbench;
    my $parser = new Test::Parser::Dbench;
    $parser->parse($text)
    printf("     Clients: ", $parser->summary('clients'));
    printf("  Throughput: ", $parser->summary('throughput')); 

Additional information is available from the subroutines listed below and from the Test::Parser baseclass.

DESCRIPTION

Top

This module provides a way to parse and neatly display information gained from the Dbench test.

FUNCTIONS

Top

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

new()

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

data()

Returns a hash representation of the Dbench data.

Override of Test::Parser's default parse_line() routine to make it able to parse Dbench logs.

AUTHOR

Top

Joshua Jakabosky <jjakabosky@os...>

COPYRIGHT

Top

SEE ALSO

Top

Test::Parser


Test-Parser documentation Contained in the Test-Parser distribution.
package Test::Parser::Dbench;

use strict;
use warnings;
use Test::Parser;

@Test::Parser::Dbench::ISA = qw(Test::Parser);
use base 'Test::Parser';

use fields qw(
    data
    );

use vars qw( %FIELDS $AUTOLOAD $VERSION );
our $VERSION = '1.7';

sub new {
    my $class = shift;
    my Test::Parser::Dbench $self = fields::new($class);
    $self->SUPER::new();
    $self->testname('Dbench');
    $self->type('unit');
    $self->{data} = ();
    $self->{summary}= qq| dbench produces only the filesystem load. It does all the same IO
    calls that the smbd server in Samba would produce when confronted with
    a netbench run. It does no networking calls.|;
    $self->{license}=qq|GPL2|;
    $self->{vendor}= qq|   Copyright (C) by Andrew Tridgell 1999, 2001
      Copyright (C) 2001 by Martin Pool|;
    $self->{description}= qq| dbench is a filesystem benchmark that generates load patterns similar to those of the commercial Netbench benchmark, but without requiring a lab of Windows load generators to run. It is now considered a de-facto standard for generating load on the Linux VFS.|;
    $self->{url}=qq|tridge\@samba.org|;
    $self->platform('FIXME');

    return $self;
}

sub data {
    my $self = shift;
    if (@_) {
        $self->{data} = @_;
    }
    return {Dbench => {data => $self ->{data}}};
}

sub parse_line {   
    my $units;
    my $name;
    my $val1;
    my $val2;
    my $self = shift;
    my $line = shift;
    if( $line=~m/Throughput\s+(\d+\.\d+)\s(\D+\/\D+)\s(\d+) (\w{5})/){
        if ( ! defined $self->{'num-datum'} ){
            $self->add_column("Throughput",$2);
            $self->add_column("Processes",$4);
            $self->{'num-datum'} = 1;
        } else {
            $self->{'num-datum'} += 1;
        }
        $self->add_data($1, '1');
        $self->add_data($3, '2');
    }
    if( $line =~ m/.*version\s+(\d+\.\d+)\s-\s(.+)/){
        $self->{version}=$1;
        $self->{release}=$1;
        $self->{vendor}=$2;
    }
}

1;
__END__