This file is indexed.

/usr/share/perl5/PCP/LogSummary.pm is in libpcp-logsummary-perl 3.9.10.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package PCP::LogSummary;

use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);

require Exporter;

@ISA         = qw(Exporter);
@EXPORT      = qw(new metric_instance);
@EXPORT_OK   = qw( );
$VERSION     = '1.01';

sub new
{
    my ( $self, $archive, $metricsref, $start, $finish ) = @_;
    my $opts    = '-F -N -z -biImMy -p6';
    my @metrica = @{$metricsref};
    my $metrics = ' ';
    my %results;

    foreach my $m (@metrica) { $metrics .= $m . ' '; }
    if (defined($start)) { $opts .= " -S'$start'"; }
    if (defined($finish)) { $opts .= " -T'$finish'"; }

    open SUMMARY, "pmlogsummary $opts $archive $metrics |" 
		|| die "pmlogsummary: $!\n";

    # metric,[inst],stocavg,timeavg,minimum,mintime,maximum,maxtime,count,units
    LINE: while (<SUMMARY>) {
	# print "Input line: $_\n";
	m/^(\S.+),(.*),(\S+),(\S+),(\S+),(.+),(\S+),(.+),(\S+),(.*)$/
		|| next LINE;

	# If counter metric doesn't cover 90% of archive, metric name
	# is preceded by an asterix.  Chop this off and set a flag.
	my $metric = $1;
	$metric =~ s/^\*//;
	my $asterix = ($metric ne $1);

	my %result;
	$result{'average'} = $3;
	$result{'timeavg'} = $4;
	$result{'minimum'} = $5;
	$result{'mintime'} = $6;
	$result{'maximum'} = $7;
	$result{'maxtime'} = $8;
	$result{'samples'} = $9;
	$result{'units'} = $10;
	$result{'ninety%'} = $asterix;

	my $key = $1;
	if ($2 ne "") { $key .= $2; }
	$results{$key} = \%result;

	# print "key=", $key, " average=$3\n";
    }
    close SUMMARY;
    return \%results;
}

sub metric_instance
{
    my ( $metric, $instance ) = @_;
    return "$metric\[\"$instance\"\]";
}

1;
__END__

=head1 NAME

PCP::LogSummary - Perl interface for pmlogsummary(1)

=head1 SYNOPSIS

  use PCP::LogSummary;

  my $summary = new PCP::LogSummary($log, \@metrics, $start, $end);

=head1 DESCRIPTION

The PCP::LogSummary module is a wrapper around the Performance Co-Pilot
pmlogsummary(1) command.
Its primary purpose is to automate the production of post-processed
pmlogsummary data, in particular to automate the step where the
summarised data is imported into a spreadsheet for further anaylsis.
This has proven to often be an iterative process - done manually it
involves much cutting+pasting, and can be a significant time waster.

=head2 EXPORT

new

metric_instance

=head1 SEE ALSO

pmlogsummary(1).

The PCP mailing list pcp@mail.performancecopilot.org can be used for
questions about this module.

Further details can be found at http://www.performancecopilot.org

=head1 AUTHOR

Nathan Scott, E<lt>nathans@debian.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008 by Aconex

This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2 (see
the "COPYING" file in the PCP source tree for further details).

=cut