Creator/HourPDP.pm

filter: Statementstmt 66.6% 4 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 75.0% 6 / 8 CC 1 SCAR 1.4
CC
1
Cov
67%
BEGIN
1.3
BEGIN
1.0
CRAP 1.1
« Creator/DayPDP.pm ↑ Summary Creator/MonthPDP.pm »
1 package RRDTool::Creator::HourPDP ;
2  
3 # ============================================
4 #
5 # Jacquelin Charbonnel - CNRS/LAREMA
6 #
7 # $Id: HourBased.pm 154 2007-04-13 16:18:43Z jaclin $
8 #
9 # ----
10 #
11 # A specific creator for round robin databases (RRD)
12 #
13 # ----
14 # $LastChangedDate: 2007-04-13 18:18:43 +0200 (Fri, 13 Apr 2007) $
15 # $LastChangedRevision: 154 $
16 # $LastChangedBy: jaclin $
17 # $URL: https://svn.math.cnrs.fr/jaclin/src/pm/RRDTool-Creator/HourBased.pm $
18 #
19 # ============================================
20  
21 require Exporter ;
22 @ISA = qw(Exporter RRDTool::Creator);
23 @EXPORT=qw() ;
24  
25 1 ▶use Carp ;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 0 ▶use RRDTool::Creator ;
Subroutine BEGIN: called CC=1 SCAR=2.6
27 use strict ;
28  
29 our $VERSION = "0.2" ;
30  
31 #-------------------------------
32 sub new
33 {
34 my($type,%h) = @_ ;
35 my ($step) ;
36  
37
38 my $this = _new RRDTool::Creator(["s","mn"],%h) ;
39
40 $this->{"rows"} = int(3600/$this->{"step"}) ;
41 $this->{"allowed_RRA_duration"} = {
42 "day" => 24
43 , "week" => 24*7
44 , "month" => 24*30
45 , "quarter" => 24*90
46 , "year" => 24*365
47 } ;
48  
49 bless $this,$type ;
50 return $this ;
51 }
52  
53 =head1 RRDTool::Creator::HourPDP
54  
55 The default RRA stores primary data points for an hour.
56 More RRA can be added for a day, a week, a month, a quarter and a year.
57 The created RRD is for an acquisition period much less than an hour, typically about some seconds or a few minutes.
58  
59 =head2 new
60  
61 This constructor neads an argument named C<step> which is the period of acquisition
62 which
63 is second(s) or minute(mn).
64  
65 $creator = new RRDTool::Creator::HourPDP(-step => "30s") ;
66 $creator->add_RRA(-duration => "day") ;
67 $creator->add_RRA(-duration => "week") ;
68 $creator->add_RRA(-duration => "month") ;
69 $creator->add_RRA(-duration => "quarter") ;
70 $creator->add_RRA(-duration => "year") ;
71  
« Creator/DayPDP.pm ↑ Summary Creator/MonthPDP.pm »