2 ################################################################################
4 # File: $RCSfile: stats,v $
5 # Revision: $Revision: 1.2 $
6 # Description: Produce statistical reports about vobs and views at this site
7 # For each vob create a log file that contains the following data:
9 # date_time;site;VOB_name;size of database;size of source pool;size of devired object;size of cleartext;size of admin data;#elements;#branches;#versions
11 # Author: Andrew@DeFaria.com
12 # Created: Mon Jan 2 17:23:08 PST 2006
13 # Modified: $Date: 2007/05/17 07:45:48 &
16 # (c) Copyright 2006-2010, Andrew@ClearSCM.com, all rights reserved.
18 #################################################################################
26 use lib "$FindBin::Bin/../lib";
37 my $cc = Clearcase->new;
38 my $site = $cc->sitename;
40 my $sitelog = "$site.site";
41 my $voblog = "$site.vob";
46 display "ERROR: $msg\n" if defined $msg;
48 display "Usage: $FindBin::Script\t[-u] [-v] [-d] [-vobs] [-site]
52 -u|sage: Display usage
53 -ve|rbose: Turn on verbose mode
54 -d|ebug: Turn on debug mode
55 -vo|bs: Produce vob stats
56 -s|ite: Produce site stats
57 -l|ogpath: Directory to put logs (Default '.')
59 Default is to report both the vobs and site statistics.
68 'usage' => sub { Usage },
69 'verbose' => sub { set_verbose },
70 'debug' => sub { set_debug },
74 ) or Usage 'Invalid parameter';
76 unless ($do_vobs or $do_site) {
77 $do_vobs = $do_site = 1;
81 my $vobs = Clearcase::Vobs->new;
82 my $total_vobsize = 0;
85 verbose 'Processing vobs...';
87 my $log = Logger->new (
93 foreach ($vobs->vobs) {
94 verbose "Processing vob: $Clearcase::vobtag_prefix$_";
95 my $vob = Clearcase::Vob->new (tag => "$Clearcase::vobtag_prefix$_");
97 my $elements = $vob->elements;
98 my $branches = $vob->branches;
99 my $versions = $vob->versions;
102 "$datetime;$site" . ';' .
105 $vob->srcsize . ';' .
108 $vob->admsize . ';' .
110 $vob->elements . ';' .
111 $vob->branches . ';' .
115 $total_vobsize += $vob->size;
120 verbose 'Processing site stats...';
122 my $log = Logger->new (
128 my $views = Clearcase::Views->new;
129 my $nbr_views = $views->views;
134 "$datetime;$site" . ';' .
136 $total_vobsize . ';' .
137 $views->dynamic . ';' .
138 $views->snapshot . ';' .