Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/LockFile/Lock.pm |
Statements | Executed 4 statements in 148µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 14µs | BEGIN@16 | LockFile::Lock::Simple::
0 | 0 | 0 | 0s | 0s | _lock_init | LockFile::Lock::
0 | 0 | 0 | 0s | 0s | filename | LockFile::Lock::
0 | 0 | 0 | 0s | 0s | line | LockFile::Lock::
0 | 0 | 0 | 0s | 0s | release | LockFile::Lock::
0 | 0 | 0 | 0s | 0s | scheme | LockFile::Lock::
0 | 0 | 0 | 0s | 0s | where | LockFile::Lock::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | ;# $Id | ||||
2 | ;# | ||||
3 | ;# @COPYRIGHT@ | ||||
4 | ;# | ||||
5 | ;# $Log: Lock.pm,v $ | ||||
6 | ;# Revision 0.3 2007/09/28 19:20:14 jv | ||||
7 | ;# Track where lock was issued in the code. | ||||
8 | ;# | ||||
9 | ;# Revision 0.2.1.1 2000/01/04 21:16:28 ram | ||||
10 | ;# patch1: track where lock was issued in the code | ||||
11 | ;# | ||||
12 | ;# Revision 0.2 1999/12/07 20:51:04 ram | ||||
13 | ;# Baseline for 0.2 release. | ||||
14 | ;# | ||||
15 | |||||
16 | 3 | 145µs | 2 | 16µs | # spent 14µs (12+2) within LockFile::Lock::Simple::BEGIN@16 which was called:
# once (12µs+2µs) by Tapper::Base::BEGIN@12 at line 16 # spent 14µs making 1 call to LockFile::Lock::Simple::BEGIN@16
# spent 2µs making 1 call to strict::import |
17 | |||||
18 | ######################################################################## | ||||
19 | package LockFile::Lock; | ||||
20 | |||||
21 | # | ||||
22 | # A lock instance -- deferred class. | ||||
23 | # | ||||
24 | |||||
25 | # | ||||
26 | # ->_lock_init | ||||
27 | # | ||||
28 | # Common lock initialization | ||||
29 | # | ||||
30 | # Attributes: | ||||
31 | # | ||||
32 | # scheme the LockFile::* object that created the lock | ||||
33 | # filename where lock was taken | ||||
34 | # line line in filename where lock was taken | ||||
35 | # | ||||
36 | sub _lock_init { | ||||
37 | my $self = shift; | ||||
38 | my ($scheme, $filename, $line) = @_; | ||||
39 | $self->{'scheme'} = $scheme; | ||||
40 | $self->{'filename'} = $filename; | ||||
41 | $self->{'line'} = $line; | ||||
42 | } | ||||
43 | |||||
44 | # | ||||
45 | # Common attribute access | ||||
46 | # | ||||
47 | |||||
48 | sub scheme { $_[0]->{'scheme'} } | ||||
49 | sub filename { $_[0]->{'filename'} } | ||||
50 | sub line { $_[0]->{'line'} } | ||||
51 | |||||
52 | # | ||||
53 | # ->release | ||||
54 | # | ||||
55 | # Release the lock | ||||
56 | # | ||||
57 | sub release { | ||||
58 | my $self = shift; | ||||
59 | return $self->scheme->release($self); | ||||
60 | } | ||||
61 | |||||
62 | # | ||||
63 | # ->where | ||||
64 | # | ||||
65 | # Returns '"filename", line #' where lock was taken. | ||||
66 | # | ||||
67 | sub where { | ||||
68 | my $self = shift; | ||||
69 | return sprintf '"%s", line %d', $self->filename, $self->line; | ||||
70 | } | ||||
71 | |||||
72 | 1 | 2µs | 1; | ||
73 |