← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/hailo
  Run on Thu Oct 21 22:50:37 2010
Reported on Thu Oct 21 22:52:15 2010

Filename/mnt/stuff/src/my-cpan/hailo/lib/Hailo/Role/Storage.pm
StatementsExecuted 20 statements in 311µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11170µs161µsHailo::Role::Storage::::BEGIN@3Hailo::Role::Storage::BEGIN@3
11118µs91µsHailo::Role::Storage::::BEGIN@3.15Hailo::Role::Storage::BEGIN@3.15
11112µs1.36msHailo::Role::Storage::::BEGIN@5Hailo::Role::Storage::BEGIN@5
11112µs404µsHailo::Role::Storage::::BEGIN@4Hailo::Role::Storage::BEGIN@4
0000s0sHailo::Role::Storage::::saveHailo::Role::Storage::save
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Hailo::Role::Storage;
2
3490µs3325µs
# spent 161µs (70+91) within Hailo::Role::Storage::BEGIN@3 which was called: # once (70µs+91µs) by Mouse::Util::_try_load_one_class at line 3 # spent 91µs (18+73) within Hailo::Role::Storage::BEGIN@3.15 which was called: # once (18µs+73µs) by Hailo::Role::Storage::BEGIN@3 at line 3
use 5.010;
# spent 161µs making 1 call to Hailo::Role::Storage::BEGIN@3 # spent 91µs making 1 call to Hailo::Role::Storage::BEGIN@3.15 # spent 73µs making 1 call to feature::import
4232µs2795µs
# spent 404µs (12+392) within Hailo::Role::Storage::BEGIN@4 which was called: # once (12µs+392µs) by Mouse::Util::_try_load_one_class at line 4
use Any::Moose '::Role';
# spent 404µs making 1 call to Hailo::Role::Storage::BEGIN@4 # spent 392µs making 1 call to Any::Moose::import
52133µs22.71ms
# spent 1.36ms (12µs+1.35) within Hailo::Role::Storage::BEGIN@5 which was called: # once (12µs+1.35ms) by Mouse::Util::_try_load_one_class at line 5
use namespace::clean -except => 'meta';
# spent 1.36ms making 1 call to Hailo::Role::Storage::BEGIN@5 # spent 1.35ms making 1 call to namespace::clean::import
6
714µs135µshas brain => (
# spent 35µs making 1 call to Mouse::Role::has
8 isa => 'Str',
9 is => 'rw',
10);
11
1213µs130µshas order => (
# spent 30µs making 1 call to Mouse::Role::has
13 isa => 'Int',
14 is => 'rw',
15);
16
1713µs130µshas hailo => (
# spent 30µs making 1 call to Mouse::Role::has
18 isa => 'HashRef',
19 is => 'ro',
20 documentation => "Miscellaneous private callbacks that Hailo provides to communicate with it",
21);
22
2313µs130µshas tokenizer_class => (
# spent 30µs making 1 call to Mouse::Role::has
24 isa => 'Str',
25 is => 'rw',
26);
27
2814µs168µsrequires 'ready';
# spent 68µs making 1 call to Mouse::Role::requires
2914µs152µsrequires 'initialized';
# spent 52µs making 1 call to Mouse::Role::requires
3013µs155µsrequires 'save';
# spent 55µs making 1 call to Mouse::Role::requires
3113µs151µsrequires 'start_learning';
# spent 51µs making 1 call to Mouse::Role::requires
3214µs151µsrequires 'stop_learning';
# spent 51µs making 1 call to Mouse::Role::requires
3313µs151µsrequires 'start_training';
# spent 51µs making 1 call to Mouse::Role::requires
3413µs154µsrequires 'stop_training';
# spent 54µs making 1 call to Mouse::Role::requires
35
36sub save {
37 # does nothing by default
38 return;
39}
40
41110µs1;
42
43=encoding utf8
44
45=head1 NAME
46
47Hailo::Role::Storage - A role representing a L<Hailo|Hailo> storage backend
48
49=head1 ATTRIBUTES
50
51=head2 C<ready>
52
53Ask the storage backend if it considers itself ready to go. E.g. a
54storage that requires a C<brain> would return false if it wasn't
55passed one.
56
57=head2 C<initialized>
58
59If you're connecting to an existing storage that already has a
60populated schema and is ready to go this'll return true.
61
62=head2 C<order>
63
64The Markov order (chain length) being used.
65
66=head2 C<brain>
67
68The name of the resource (file name, database name) to use as storage.
69
70=head1 METHODS
71
72=head2 C<new>
73
74This is the constructor. It accept the attributes specified in
75L</ATTRIBUTES>.
76
77=head2 C<save>
78
79Saves the current state.
80
81=head2 C<learn_tokens>
82
83Learns from a sequence of tokens. Takes an array reference of strings.
84
85=head2 C<make_reply>
86
87Takes an (optional) array reference of tokens and returns a reply (arrayref
88of tokens) that might be relevant.
89
90=head2 C<token_total>
91
92Takes no arguments. Returns the number of tokens the brain knows.
93
94=head2 C<expr_total>
95
96Takes no arguments. Returns the number of expressions the brain knows.
97
98=head2 C<start_learning>
99
100Takes no arguments. This method is called by L<Hailo|Hailo> right before learning
101begins.
102
103=head2 C<stop_learning>
104
105Takes no arguments. This method is called by L<Hailo|Hailo> right after learning
106finishes.
107
108=head2 C<start_training>
109
110Takes no arguments. This method is called by L<Hailo|Hailo> right before training
111begins.
112
113=head2 C<stop_training>
114
115Takes no arguments. This method is called by L<Hailo|Hailo> right after training
116finishes.
117
118=head1 AUTHOR
119
120Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com
121
122=head1 LICENSE AND COPYRIGHT
123
124Copyright 2010 Hinrik E<Ouml>rn SigurE<eth>sson
125
126This program is free software, you can redistribute it and/or modify
127it under the same terms as Perl itself.
128
12919µs14.34ms=cut