| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sys::Trace::Results; |
|
2
|
3
|
|
|
3
|
|
15
|
use strict; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
2050
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Sys::Trace::Results - Results of a Sys::Trace |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This object holds the results of a trace performed via L. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 METHODS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head2 new($trace) |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Initialises the object from a given trace. Normally called via the C |
|
17
|
|
|
|
|
|
|
method of L. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
0
|
|
|
0
|
1
|
|
my($class, $trace) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
return bless $trace->parse, $class; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 count |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Returns the number of calls that are contained within this trace. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub count { |
|
34
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
|
35
|
0
|
|
|
|
|
|
return scalar @$self; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 calls([$call]) |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Return a list of all the calls. The system call name will be filtered against |
|
41
|
|
|
|
|
|
|
C<$call> if provided (either a string or a Regexp reference). |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Each element in the list will be a hash reference of the form: |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
{ |
|
46
|
|
|
|
|
|
|
name => "/path/to/file", # filename, if relevant |
|
47
|
|
|
|
|
|
|
call => "open", # system call name |
|
48
|
|
|
|
|
|
|
systime => 0.000012, # time spent in call |
|
49
|
|
|
|
|
|
|
walltime => 1277664686.665232 # |
|
50
|
|
|
|
|
|
|
args => [ ... ] # arguments |
|
51
|
|
|
|
|
|
|
errno => "ENOENT" # errno, if error occurred |
|
52
|
|
|
|
|
|
|
strerror => "No such file or directory", # error string, if returned |
|
53
|
|
|
|
|
|
|
pid => 1234, # pid being traced |
|
54
|
|
|
|
|
|
|
return => -1 |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub calls { |
|
60
|
0
|
|
|
0
|
1
|
|
my($self, $call) = @_; |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
if($call) { |
|
63
|
0
|
0
|
|
|
|
|
$call = qr/^\Q$call\E$/ unless ref $call; |
|
64
|
0
|
|
|
|
|
|
return grep { $_->{call} =~ $call } @$self; |
|
|
0
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} else { |
|
66
|
0
|
|
|
|
|
|
return @$self; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 files([$path]) |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Return a list of files that were referenced by the system calls in this trace, |
|
73
|
|
|
|
|
|
|
optionally filtering on $path. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub files { |
|
78
|
0
|
|
|
0
|
1
|
|
my($self, $path) = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
0
|
0
|
|
|
|
$path = qr/^\Q$path\E/ if $path && not ref $path; |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my %files; |
|
83
|
0
|
|
|
|
|
|
for my $call(@$self) { |
|
84
|
0
|
0
|
|
|
|
|
next unless $call->{name}; |
|
85
|
0
|
0
|
|
|
|
|
next unless $call->{name} =~ $path; |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$files{$call->{name}}++; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return keys %files; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 TODO |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is currently very basic, this module should provide the ability to perform |
|
96
|
|
|
|
|
|
|
analysis. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L for copyright, etc. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |