line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewFangle::CustomEvent 0.08 { |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
37
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
159
|
|
4
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
123
|
|
5
|
6
|
|
|
6
|
|
86
|
use 5.014; |
|
6
|
|
|
|
|
18
|
|
6
|
6
|
|
|
6
|
|
30
|
use NewFangle::FFI; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
474
|
|
7
|
6
|
|
|
6
|
|
36
|
use Carp (); |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
1115
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: NewRelic custom event class |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$ffi->attach( [ create_custom_event => 'new' ] => ['string'] => 'newrelic_custom_event_t' => sub { |
13
|
|
|
|
|
|
|
my($xsub, undef, $event_type) = @_; |
14
|
|
|
|
|
|
|
my $self = $xsub->($event_type); |
15
|
|
|
|
|
|
|
Carp::croak("unable to create NewFangle::CustomEvent instance, see log for details") unless defined $self; |
16
|
|
|
|
|
|
|
$self; |
17
|
|
|
|
|
|
|
}); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$ffi->attach( [ "custom_event_add_attribute_$_" => "add_attribute_$_" ] => [ 'newrelic_custom_event_t', 'string', $_ ] => 'bool' ) |
21
|
|
|
|
|
|
|
for qw( int long double string ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$ffi->attach( [ discard_custom_event => 'DESTROY' ] => ['opaque*'] => 'bool' => sub { |
24
|
|
|
|
|
|
|
my($xsub, $self) = @_; |
25
|
|
|
|
|
|
|
my $ptr = $$self; |
26
|
|
|
|
|
|
|
$xsub->(\$ptr) if $ptr; |
27
|
|
|
|
|
|
|
}); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |