summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl.straw/lib/IPC/Run3/ProfArrayBuffer.pm
blob: 15c58ea0b208d859c952655f8bbe020aac275ce2 (plain)
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
package IPC::Run3::ProfArrayBuffer;

$VERSION = 0.043;

=head1 NAME

IPC::Run3::ProfArrayBuffer - Store profile events in RAM in an array

=head1 SYNOPSIS

=head1 DESCRIPTION

=cut

use strict;

=head1 METHODS

=over

=item C<< IPC::Run3::ProfArrayBuffer->new() >>

=cut

sub new {
    my $class = ref $_[0] ? ref shift : shift;

    my $self = bless { @_ }, $class;

    $self->{Events} = [];

    return $self;
}

=item C<< $buffer->app_call(@events) >>

=item C<< $buffer->app_exit(@events) >>

=item C<< $buffer->run_exit(@events) >>

The three above methods push the given events onto the stack of recorded
events.

=cut

for my $subname ( qw(app_call app_exit run_exit) ) {
  no strict 'refs';
  *{$subname} = sub {
      push @{shift->{Events}}, [ $subname => @_ ];
  };
}

=item get_events

Returns a list of all the events.  Each event is an ARRAY reference
like:

   [ "app_call", 1.1, ... ];

=cut

sub get_events {
    my $self = shift;
    @{$self->{Events}};
}

=back

=head1 LIMITATIONS

=head1 COPYRIGHT

Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved

=head1 LICENSE

You may use this module under the terms of the BSD, Artistic, or GPL licenses,
any version.

=head1 AUTHOR

Barrie Slaymaker E<lt>barries@slaysys.comE<gt>

=cut

1;