| 1 | use strict; | ||
| 2 | use DBI; | ||
| 3 | use IO::File; | ||
| 4 | |||
| 5 | package StatsView::Oracle::Monitor; | ||
| 6 | |||
| 7 | ################################################################################ | ||
| 8 | |||
| 9 | sub new($$$$) | ||
| 10 | { | ||
| 11 | my ($class, $db, $fh, $rate) = @_; | ||
| 12 | $class = ref($class) || $class; | ||
| 13 | my $self = { db => $db, fh => $fh, rate => $rate }; | ||
| 14 | return(bless($self, $class)); | ||
| 15 | } | ||
| 16 | |||
| 17 | ################################################################################ | ||
| 18 | |||
| 19 | sub header($$$$$) | ||
| 20 | { | ||
| 21 | my ($self, $type, $title, $headings, $formats) = @_; | ||
| 22 | my $class = ref($self); | ||
| 23 | $class =~ s/^.*:://; | ||
| 24 | |||
| 25 | $self->{fh}->print("Title: $title\n", | ||
| 26 | "Statistics: $class $type\n", | ||
| 27 | "Headings: $headings\n", | ||
| 28 | "Formats: $formats\n\n"); | ||
| 29 | } | ||
| 30 | |||
| 31 | ################################################################################ | ||
| 32 | |||
| 33 | sub data($$;) | ||
| 34 | { | ||
| 35 | my ($self, $timestamp, @data) = @_; | ||
| 36 | my $class = ref($self); | ||
| 37 | $class =~ s/^.*:://; | ||
| 38 | $self->{fh}->print("$class $timestamp\n", join("\n", @data), "\n\n"); | ||
| 39 | } | ||
| 40 | |||
| 41 | ################################################################################ | ||
| 42 | |||
| 43 | sub sample($$) | ||
| 44 | { | ||
| 45 | my $self = shift; | ||
| 46 | my $class = ref($self) || $self; | ||
| 47 | die("No sample method defined for class $class\n"); | ||
| 48 | } | ||
| 49 | |||
| 50 | ################################################################################ | ||
| 51 | 1; |