← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:22:55 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Model.pm
StatementsExecuted 4075 statements in 31.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3311119.8ms1.78sTapper::Model::::get_hardware_overviewTapper::Model::get_hardware_overview
1801119.5ms2.77sTapper::Model::::free_hosts_with_featuresTapper::Model::free_hosts_with_features
1111.70ms1.94msTapper::Model::::BEGIN@24Tapper::Model::BEGIN@24
111640µs20.5msTapper::Model::::BEGIN@25Tapper::Model::BEGIN@25
111337µs16.0msTapper::Model::::modelTapper::Model::model
111256µs359µsTapper::Model::::BEGIN@26Tapper::Model::BEGIN@26
11145µs100µsTapper::Model::::BEGIN@13Tapper::Model::BEGIN@13
11111µs62µsTapper::Model::::BEGIN@90Tapper::Model::BEGIN@90
1119µs27µsTapper::Model::::BEGIN@10Tapper::Model::BEGIN@10
1119µs54µsTapper::Model::::BEGIN@13.3Tapper::Model::BEGIN@13.3
1119µs9µsTapper::Model::::BEGIN@2Tapper::Model::BEGIN@2
1119µs13µsTapper::Model::::BEGIN@11Tapper::Model::BEGIN@11
1119µs27µsTapper::Model::::BEGIN@21Tapper::Model::BEGIN@21
1118µs8µsTapper::Model::::BEGIN@22Tapper::Model::BEGIN@22
0000s0sTapper::Model::::get_or_create_userTapper::Model::get_or_create_user
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Tapper::Model;
2
# spent 9µs within Tapper::Model::BEGIN@2 which was called: # once (9µs+0s) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 4
BEGIN {
315µs $Tapper::Model::AUTHORITY = 'cpan:AMD';
4124µs19µs}
# spent 9µs making 1 call to Tapper::Model::BEGIN@2
5{
621µs $Tapper::Model::VERSION = '0.001';
7}
8# ABSTRACT: Tapper - Context sensitive connected DBIC schema
9
10327µs245µs
# spent 27µs (9+18) within Tapper::Model::BEGIN@10 which was called: # once (9µs+18µs) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 10
use warnings;
# spent 27µs making 1 call to Tapper::Model::BEGIN@10 # spent 18µs making 1 call to warnings::import
11321µs216µs
# spent 13µs (9+4) within Tapper::Model::BEGIN@11 which was called: # once (9µs+4µs) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 11
use strict;
# spent 13µs making 1 call to Tapper::Model::BEGIN@11 # spent 4µs making 1 call to strict::import
12
13668µs3200µs
# spent 100µs (45+54) within Tapper::Model::BEGIN@13 which was called: # once (45µs+54µs) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 13 # spent 54µs (9+46) within Tapper::Model::BEGIN@13.3 which was called: # once (9µs+46µs) by Tapper::Model::BEGIN@13 at line 13
use 5.010;
# spent 100µs making 1 call to Tapper::Model::BEGIN@13 # spent 54µs making 1 call to Tapper::Model::BEGIN@13.3 # spent 46µs making 1 call to feature::import
14
15# avoid these warnings
16# Subroutine initialize redefined at /2home/ss5/perl510/lib/site_perl/5.10.0/Class/C3.pm line 70.
17# Subroutine uninitialize redefined at /2home/ss5/perl510/lib/site_perl/5.10.0/Class/C3.pm line 88.
18# Subroutine reinitialize redefined at /2home/ss5/perl510/lib/site_perl/5.10.0/Class/C3.pm line 101.
19# by forcing correct load order.
20
21319µs244µs
# spent 27µs (9+18) within Tapper::Model::BEGIN@21 which was called: # once (9µs+18µs) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 21
use Class::C3;
# spent 27µs making 1 call to Tapper::Model::BEGIN@21 # spent 18µs making 1 call to Class::C3::import
22319µs18µs
# spent 8µs within Tapper::Model::BEGIN@22 which was called: # once (8µs+0s) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 22
use MRO::Compat;
# spent 8µs making 1 call to Tapper::Model::BEGIN@22
23
243128µs21.97ms
# spent 1.94ms (1.70+242µs) within Tapper::Model::BEGIN@24 which was called: # once (1.70ms+242µs) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 24
use Memoize;
# spent 1.94ms making 1 call to Tapper::Model::BEGIN@24 # spent 34µs making 1 call to Exporter::import
253124µs120.5ms
# spent 20.5ms (640µs+19.9) within Tapper::Model::BEGIN@25 which was called: # once (640µs+19.9ms) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 25
use Tapper::Config;
# spent 20.5ms making 1 call to Tapper::Model::BEGIN@25
263396µs2387µs
# spent 359µs (256+103) within Tapper::Model::BEGIN@26 which was called: # once (256µs+103µs) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 26
use parent 'Exporter';
# spent 359µs making 1 call to Tapper::Model::BEGIN@26 # spent 28µs making 1 call to parent::import
27
281900nsour @EXPORT_OK = qw(model get_hardware_overview);
29
30
3112µs1204µsmemoize('model');
# spent 204µs making 1 call to Memoize::memoize
32sub model
33
# spent 16.0ms (337µs+15.7) within Tapper::Model::model which was called: # once (337µs+15.7ms) by Memoize::_memoizer at line 245 of Memoize.pm
{
348272µs my ($schema_basename) = @_;
35
36 $schema_basename ||= 'TestrunDB';
37
38 my $schema_class = "Tapper::Schema::$schema_basename";
39
40 # lazy load class
41 eval "use $schema_class"; ## no critic (ProhibitStringyEval)
# spent 92µs executing statements in string eval
# includes 78µs spent executing 1 call to 1 sub defined therein.
42 if ($@) {
43 print STDERR $@;
44 return;
45 }
46410.5ms my $model = $schema_class->connect(Tapper::Config->subconfig->{database}{$schema_basename}{dsn},
# spent 10.5ms making 1 call to DBIx::Class::Schema::connect # spent 10µs making 3 calls to Tapper::Config::subconfig, avg 3µs/call
47 Tapper::Config->subconfig->{database}{$schema_basename}{username},
48 Tapper::Config->subconfig->{database}{$schema_basename}{password});
49118µs eval {
50 # maybe no TestrunSchedulings in DB yet
51111µs45.10ms $model->resultset('TestrunScheduling')->first->gen_schema_functions if $schema_basename eq 'TestrunDB';
# spent 2.96ms making 1 call to DBIx::Class::ResultSet::first # spent 1.91ms making 1 call to Tapper::Schema::TestrunDB::Result::TestrunScheduling::gen_schema_functions # spent 228µs making 1 call to DBIx::Class::Schema::resultset # spent 4µs making 1 call to DBIx::Class::Storage::DBI::Cursor::DESTROY
52 };
53116µs144µs return $model;
# spent 44µs making 1 call to DBIx::Class::Storage::DBI::Cursor::DESTROY
54}
55
56
57sub get_or_create_user {
58 my ($login) = @_;
59 my $user_search = model('TestrunDB')->resultset('User')->search({ login => $login });
60 my $user_id;
61 if (not $user_search->count) {
62 my $user = model('TestrunDB')->resultset('User')->new({ login => $login });
63 $user->insert;
64 return $user->id;
65 } else {
66 my $user = $user_search->first; # at least one user
67 return $user->id;
68
69 }
70 return;
71}
72
73
74sub free_hosts_with_features
75
# spent 2.77s (19.5ms+2.75) within Tapper::Model::free_hosts_with_features which was called 180 times, avg 15.4ms/call: # 180 times (19.5ms+2.75s) by Tapper::MCP::Scheduler::Controller::get_next_job at line 78 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 15.4ms/call
{
767208.01ms540164ms my $hosts = model('TestrunDB')->resultset("Host")->free_hosts;
# spent 112ms making 180 calls to DBIx::Class::Schema::resultset, avg 620µs/call # spent 49.6ms making 180 calls to Tapper::Schema::TestrunDB::ResultSet::Host::free_hosts, avg 275µs/call # spent 2.39ms making 180 calls to Memoize::__ANON__[(eval 256)[Memoize.pm:71]:1], avg 13µs/call
77 my @hosts_with_features;
7813245.01ms511791ms while (my $host = $hosts->next) {
# spent 791ms making 511 calls to DBIx::Class::ResultSet::next, avg 1.55ms/call
796621.78s my $features = get_hardware_overview($host->id);
# spent 1.78s making 331 calls to Tapper::Model::get_hardware_overview, avg 5.37ms/call # spent 4.60ms making 331 calls to Tapper::Schema::TestrunDB::Result::Host::id, avg 14µs/call
803314.15ms $features->{hostname} = $host->name;
# spent 4.15ms making 331 calls to Tapper::Schema::TestrunDB::Result::Host::name, avg 13µs/call
81 my $queues = [];
82# $queues = [ map {$_->queue->id } $host->queuehosts->all ];
83 push @hosts_with_features, {host => $host, features => $features, queues => $queues};
84 }
85 return \@hosts_with_features;
86}
87
- -
90398µs2112µs
# spent 62µs (11+50) within Tapper::Model::BEGIN@90 which was called: # once (11µs+50µs) by Tapper::MCP::Scheduler::Controller::BEGIN@8 at line 90
use Carp;
# spent 62µs making 1 call to Tapper::Model::BEGIN@90 # spent 50µs making 1 call to Exporter::import
91
92sub get_hardware_overview
93
# spent 1.78s (19.8ms+1.76) within Tapper::Model::get_hardware_overview which was called 331 times, avg 5.37ms/call: # 331 times (19.8ms+1.76s) by Tapper::Model::free_hosts_with_features at line 79, avg 5.37ms/call
{
94198617.0ms my ($host_id) = @_;
95
96993961ms my $host = model('TestrunDB')->resultset('Host')->find($host_id);
# spent 857ms making 331 calls to DBIx::Class::ResultSet::find, avg 2.59ms/call # spent 101ms making 331 calls to DBIx::Class::Schema::resultset, avg 305µs/call # spent 2.39ms making 331 calls to Memoize::__ANON__[(eval 256)[Memoize.pm:71]:1], avg 7µs/call
97 return qq(Host with id '$host_id' not found) unless $host;
98
99 my %all_features;
100
101331790ms foreach my $feature ($host->features) {
# spent 790ms making 331 calls to Tapper::Schema::TestrunDB::Result::Host::features, avg 2.39ms/call
102 $all_features{$feature->entry} = $feature->value;
103 }
104 return \%all_features;
105
106}
107
108
10915µs1; # End of Tapper::Model
110
111__END__