|
Revision 4196, 0.7 kB
(checked in by takayama, 3 months ago)
|
|
* Set svn keywords
|
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | #!/usr/bin/perl -w |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use Getopt::Long; |
|---|
| 5 | use lib qw( lib extlib ); |
|---|
| 6 | use MT::Util::PerformanceData; |
|---|
| 7 | |
|---|
| 8 | GetOptions( |
|---|
| 9 | 'path=s' => \my ($logs_path), |
|---|
| 10 | 'file=s' => \my ($log_file), |
|---|
| 11 | 'sort=s' => \my ($sort_key), |
|---|
| 12 | ); |
|---|
| 13 | |
|---|
| 14 | if ( !$logs_path ) { |
|---|
| 15 | usage(); |
|---|
| 16 | exit; |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | opendir DIRH, $logs_path or die "couldn't open $logs_path: $!"; |
|---|
| 20 | my @dir = readdir DIRH; |
|---|
| 21 | closedir DIRH; |
|---|
| 22 | |
|---|
| 23 | foreach my $file (@dir) { |
|---|
| 24 | next if $file eq '.' or $file eq '..'; |
|---|
| 25 | next if $log_file && $file ne $log_file; |
|---|
| 26 | my $data = MT::Util::PerformanceData->new( |
|---|
| 27 | path => $logs_path, |
|---|
| 28 | file => $file, |
|---|
| 29 | ); |
|---|
| 30 | $data->report( sort => $sort_key, ); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | sub usage { |
|---|
| 34 | print STDERR << "EOT"; |
|---|
| 35 | usage: $0 -path='log_files_path' [-file='log_file'] [-sort='sort_key'] |
|---|
| 36 | EOT |
|---|
| 37 | } |
|---|