Oracle/SharedPool.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 35 CC 2 SCAR 12.8
CC
2
Cov
0%
sample
6.0
new
2.0
BEGIN
2.0
CRAP 3.6
1 ################################################################################
2 # Monitor the Shared Pool
3  
4 use strict;
5 use StatsView::Oracle::Monitor;
6 package StatsView::Oracle::SharedPool;
7 @StatsView::Oracle::SharedPool::ISA = qw(StatsView::Oracle::Monitor);
8  
9 ################################################################################
10  
11 sub new($$$$)
12 {
13 my ($class, $db, $fh, $rate) = @_;
14 $class = ref($class) || $class;
15 my $self = $class->SUPER::new($db, $fh, $rate);
16 my $query = q(select /*+ rule */ name, count(value), sum(value)
17 from v$sesstat, v$statname
18 where name in ('session pga memory', 'session pga memory max')
19 and v$sesstat.statistic# = v$statname.statistic# group by name);
20 $self->{cursor} = $db->prepare($query);
21 $self->header("singlerow", "Shared Pool activity",
22 "Sessions,Session Memory,Max Session Memory", "NNN");
23 return($self);
24 }
25  
26 ##############################################################################
27  
28 sub sample($$)
29 {
30 my ($self, $ts) = @_;
31 $self->{cursor}->execute();
32 my ($n1, $s1, $v1) = $self->{cursor}->fetchrow();
33 my ($n2, $s2, $v2) = $self->{cursor}->fetchrow();
34 if ($n1 eq 'max session memory') { my $v3 = $v1, $v1 = $v2; $v2 = $v3 }
35 $self->data($ts, "$s1,$v1,$v2");
36 }
37  
38 ################################################################################
39 1;