line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Goo::Thing::log::Profiler; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: Profiler.pm |
11
|
|
|
|
|
|
|
# Description: Show a profile of the log |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 15/10/2005 Version 1 |
16
|
|
|
|
|
|
|
# 02/12/2005 Removed backticks in run (/usr/bin/tail) |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
############################################################################### |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
3499
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
7
|
use Goo::Object; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
23
|
1
|
|
|
1
|
|
8
|
use Goo::Profile; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
24
|
1
|
|
|
1
|
|
7
|
use Goo::Prompter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
7
|
use base qw(Goo::Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
367
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
############################################################################### |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
# run - return a table of methods |
32
|
|
|
|
|
|
|
# |
33
|
|
|
|
|
|
|
############################################################################### |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub run { |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my ($this, $thing) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $profile = Goo::Profile->new($thing); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
while (1) { |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$profile->clear(); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$profile->show_header("Log Viewer", $thing->get_filename(), $thing->get_location()); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $log_file_location = $thing->get_full_path(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$profile->set_description("Tail of $log_file_location"); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# grab the tail of the log |
52
|
|
|
|
|
|
|
my @log_tail = Goo::FileUtilities::get_last_lines($log_file_location, 6); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$profile->add_rendered_table(join("\n", $log_tail)); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# add a list of Things found in this Thing |
57
|
|
|
|
|
|
|
$profile->add_things_table($log_tail); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$profile->display(); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# prompt the user for the next command |
62
|
|
|
|
|
|
|
$profile->get_command(); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Goo::Thing::log::Profiler - Show a profile of the log |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
use Goo::Thing::log::Profiler; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 METHODS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item run |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
return a table of methods |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 AUTHOR |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Nigel Hamilton <nigel@turbo10.com> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SEE ALSO |
102
|
|
|
|
|
|
|
|