| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/BenchmarkAnything/Storage/Backend/SQL/Query.pm |
| Statements | Executed 225492 statements in 28.5s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 27629 | 15 | 2 | 863ms | 5.62s | BenchmarkAnything::Storage::Backend::SQL::Query::execute_query |
| 2000 | 2 | 1 | 127ms | 22.8s | BenchmarkAnything::Storage::Backend::SQL::Query::finish_transaction |
| 2000 | 2 | 1 | 73.5ms | 212ms | BenchmarkAnything::Storage::Backend::SQL::Query::start_transaction |
| 1028 | 2 | 1 | 5.89ms | 7.91ms | BenchmarkAnything::Storage::Backend::SQL::Query::last_insert_id |
| 1 | 1 | 1 | 8µs | 9µs | BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@5 |
| 1 | 1 | 1 | 6µs | 19µs | BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@7 |
| 1 | 1 | 1 | 6µs | 6µs | BenchmarkAnything::Storage::Backend::SQL::Query::new |
| 1 | 1 | 1 | 4µs | 6µs | BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@6 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package BenchmarkAnything::Storage::Backend::SQL::Query; | ||||
| 2 | 1 | 300ns | our $AUTHORITY = 'cpan:TAPPER'; | ||
| 3 | # ABSTRACT: BenchmarkAnything::Storage::Backend::SQL - querying - base class | ||||
| 4 | 1 | 100ns | $BenchmarkAnything::Storage::Backend::SQL::Query::VERSION = '0.023'; | ||
| 5 | 2 | 13µs | 2 | 10µs | # spent 9µs (8+1) within BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@5 which was called:
# once (8µs+1µs) by base::import at line 5 # spent 9µs making 1 call to BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@5
# spent 1µs making 1 call to strict::import |
| 6 | 2 | 12µs | 2 | 8µs | # spent 6µs (4+2) within BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@6 which was called:
# once (4µs+2µs) by base::import at line 6 # spent 6µs making 1 call to BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@6
# spent 2µs making 1 call to warnings::import |
| 7 | 2 | 261µs | 2 | 31µs | # spent 19µs (6+12) within BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@7 which was called:
# once (6µs+12µs) by base::import at line 7 # spent 19µs making 1 call to BenchmarkAnything::Storage::Backend::SQL::Query::BEGIN@7
# spent 12µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | # spent 6µs within BenchmarkAnything::Storage::Backend::SQL::Query::new which was called:
# once (6µs+0s) by BenchmarkAnything::Storage::Backend::SQL::new at line 162 of BenchmarkAnything/Storage/Backend/SQL.pm | ||||
| 10 | |||||
| 11 | 1 | 400ns | my ( $s_self, $hr_atts ) = @_; | ||
| 12 | |||||
| 13 | 1 | 500ns | my $or_self = bless {}, $s_self; | ||
| 14 | |||||
| 15 | 1 | 600ns | for my $s_key (qw/ config dbh /) { | ||
| 16 | 2 | 900ns | if (! $hr_atts->{$s_key} ) { | ||
| 17 | require Carp; | ||||
| 18 | Carp::confess("missing parameter '$s_key'"); | ||||
| 19 | } | ||||
| 20 | } | ||||
| 21 | |||||
| 22 | 1 | 3µs | $or_self->{dbh} = $hr_atts->{dbh}; | ||
| 23 | 1 | 300ns | $or_self->{debug} = $hr_atts->{debug} || 0; | ||
| 24 | 1 | 100ns | $or_self->{config} = $hr_atts->{config}; | ||
| 25 | |||||
| 26 | 1 | 2µs | return $or_self; | ||
| 27 | |||||
| 28 | } | ||||
| 29 | |||||
| 30 | # spent 5.62s (863ms+4.75) within BenchmarkAnything::Storage::Backend::SQL::Query::execute_query which was called 27629 times, avg 203µs/call:
# 4650 times (131ms+731ms) by BenchmarkAnything::Storage::Backend::SQL::Query::mysql::insert_addvaluerelation at line 425 of BenchmarkAnything/Storage/Backend/SQL/Query/mysql.pm, avg 185µs/call
# 4650 times (147ms+495ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_addtyperelation at line 515 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 138µs/call
# 4650 times (165ms+453ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_addtype at line 491 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 133µs/call
# 4650 times (107ms+494ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_addvalue at line 503 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 129µs/call
# 1000 times (43.4ms+622ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::update_raw_bench_bundle_set_processed at line 616 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 665µs/call
# 1000 times (44.7ms+483ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_complete_benchmark_point at line 176 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 527µs/call
# 1000 times (41.7ms+341ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_raw_bench_bundle_for_lock at line 689 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 383µs/call
# 1000 times (34.2ms+295ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::start_processing_raw_bench_bundle at line 604 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 329µs/call
# 1000 times (29.7ms+193ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_raw_bench_bundle_for_processing at line 704 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 222µs/call
# 1000 times (20.2ms+200ms) by BenchmarkAnything::Storage::Backend::SQL::Query::mysql::insert_benchmark_value at line 382 of BenchmarkAnything/Storage/Backend/SQL/Query/mysql.pm, avg 220µs/call
# 1000 times (37.1ms+172ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_benchmark_point_essentials at line 117 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 209µs/call
# 1000 times (29.4ms+137ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_benchmark at line 405 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 167µs/call
# 1000 times (32.1ms+112ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::select_min_subsume_type at line 268 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm, avg 144µs/call
# 28 times (501µs+3.86ms) by BenchmarkAnything::Storage::Backend::SQL::Query::mysql::insert_addvalue at line 410 of BenchmarkAnything/Storage/Backend/SQL/Query/mysql.pm, avg 156µs/call
# once (49µs+23.5ms) by BenchmarkAnything::Storage::Backend::SQL::Query::common::delete_processed_raw_bench_bundles at line 652 of BenchmarkAnything/Storage/Backend/SQL/Query/common.pm | ||||
| 31 | |||||
| 32 | 27629 | 13.1ms | my ( $or_self, $s_statement, @a_vals ) = @_; | ||
| 33 | |||||
| 34 | 27629 | 7.85ms | if ( $or_self->{debug} ) { | ||
| 35 | warn $s_statement . ' (' . (join ',', @a_vals) . ')'; | ||||
| 36 | } | ||||
| 37 | |||||
| 38 | 27629 | 445ms | 110516 | 399ms | local $or_self->{dbh}{RaiseError} = 1; # spent 241ms making 27629 calls to DBI::common::EXISTS, avg 9µs/call
# spent 120ms making 27629 calls to DBD::_::common::EXISTS, avg 4µs/call
# spent 25.1ms making 27629 calls to DBI::common::STORE, avg 909ns/call
# spent 13.3ms making 27629 calls to DBI::common::FETCH, avg 483ns/call |
| 39 | |||||
| 40 | 27629 | 122ms | 27629 | 42.9ms | my $s_key = Digest::MD5::md5($s_statement); # spent 42.9ms making 27629 calls to Digest::MD5::md5, avg 2µs/call |
| 41 | 27629 | 130ms | 27614 | 45.3ms | if ( $or_self->{prepared}{$s_key} ) { # spent 45.3ms making 27614 calls to DBI::st::finish, avg 2µs/call |
| 42 | $or_self->{prepared}{$s_key}->finish(); | ||||
| 43 | } | ||||
| 44 | else { | ||||
| 45 | 15 | 77µs | 30 | 965µs | $or_self->{prepared}{$s_key} = $or_self->{dbh}->prepare( $s_statement ); # spent 509µs making 15 calls to DBI::db::prepare, avg 34µs/call
# spent 456µs making 15 calls to DBD::mysql::db::prepare, avg 30µs/call |
| 46 | } | ||||
| 47 | |||||
| 48 | 27629 | 4.47s | 27629 | 4.33s | $or_self->{prepared}{$s_key}->execute( @a_vals ); # spent 4.33s making 27629 calls to DBI::st::execute, avg 157µs/call |
| 49 | |||||
| 50 | 27629 | 382ms | return $or_self->{prepared}{$s_key}; | ||
| 51 | |||||
| 52 | } | ||||
| 53 | |||||
| 54 | # spent 7.91ms (5.89+2.02) within BenchmarkAnything::Storage::Backend::SQL::Query::last_insert_id which was called 1028 times, avg 8µs/call:
# 1000 times (5.77ms+1.98ms) by BenchmarkAnything::Storage::Backend::SQL::add_single_benchmark at line 259 of BenchmarkAnything/Storage/Backend/SQL.pm, avg 8µs/call
# 28 times (122µs+36µs) by BenchmarkAnything::Storage::Backend::SQL::add_single_benchmark at line 338 of BenchmarkAnything/Storage/Backend/SQL.pm, avg 6µs/call | ||||
| 55 | |||||
| 56 | 1028 | 918µs | my ( $or_self, $s_table, $s_column ) = @_; | ||
| 57 | |||||
| 58 | return $or_self->{dbh}->last_insert_id( | ||||
| 59 | 1028 | 7.22ms | 1028 | 2.02ms | undef, undef, $s_table, $s_column, # spent 2.02ms making 1028 calls to DBI::db::last_insert_id, avg 2µs/call |
| 60 | ); | ||||
| 61 | |||||
| 62 | } | ||||
| 63 | |||||
| 64 | # spent 212ms (73.5+138) within BenchmarkAnything::Storage::Backend::SQL::Query::start_transaction which was called 2000 times, avg 106µs/call:
# 1000 times (36.1ms+71.7ms) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 415 of BenchmarkAnything/Storage/Backend/SQL.pm, avg 108µs/call
# 1000 times (37.4ms+66.4ms) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 431 of BenchmarkAnything/Storage/Backend/SQL.pm, avg 104µs/call | ||||
| 65 | |||||
| 66 | 2000 | 2.06ms | my ( $or_self ) = @_; | ||
| 67 | |||||
| 68 | 2000 | 34.7ms | 8000 | 53.4ms | local $or_self->{dbh}{RaiseError} = 1; # spent 28.9ms making 2000 calls to DBI::common::EXISTS, avg 14µs/call
# spent 20.9ms making 2000 calls to DBD::_::common::EXISTS, avg 10µs/call
# spent 2.34ms making 2000 calls to DBI::common::STORE, avg 1µs/call
# spent 1.23ms making 2000 calls to DBI::common::FETCH, avg 613ns/call |
| 69 | |||||
| 70 | 2000 | 3.21ms | eval { | ||
| 71 | 2000 | 7.69ms | 2000 | 1.26ms | $or_self->{old_AutoCommit} = $or_self->{dbh}{AutoCommit}; # spent 1.26ms making 2000 calls to DBI::common::FETCH, avg 632ns/call |
| 72 | 2000 | 122ms | 2000 | 100ms | $or_self->{dbh}{AutoCommit} = 0; # spent 100ms making 2000 calls to DBI::common::STORE, avg 50µs/call |
| 73 | }; | ||||
| 74 | 2000 | 1.68ms | if ( $@ ) { | ||
| 75 | if ( $or_self->{debug} ) { | ||||
| 76 | require Carp; | ||||
| 77 | Carp::cluck('Transactions not supported by your database'); | ||||
| 78 | } | ||||
| 79 | } | ||||
| 80 | else { | ||||
| 81 | 2000 | 1.86ms | $or_self->{transaction_supported} = 1; | ||
| 82 | } | ||||
| 83 | |||||
| 84 | 2000 | 16.9ms | return 1; | ||
| 85 | |||||
| 86 | } | ||||
| 87 | |||||
| 88 | # spent 22.8s (127ms+22.6) within BenchmarkAnything::Storage::Backend::SQL::Query::finish_transaction which was called 2000 times, avg 11.4ms/call:
# 1000 times (56.0ms+11.7s) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 427 of BenchmarkAnything/Storage/Backend/SQL.pm, avg 11.8ms/call
# 1000 times (71.3ms+10.9s) by BenchmarkAnything::Storage::Backend::SQL::process_queued_multi_benchmark at line 443 of BenchmarkAnything/Storage/Backend/SQL.pm, avg 11.0ms/call | ||||
| 89 | |||||
| 90 | 2000 | 1.84ms | my ( $or_self, $s_error ) = @_; | ||
| 91 | |||||
| 92 | 2000 | 3.46ms | 2000 | 6.57ms | if ( $or_self->{transaction_supported} ) { # spent 6.57ms making 2000 calls to DBI::common::STORE, avg 3µs/call |
| 93 | |||||
| 94 | 2000 | 34.2ms | 8000 | 36.4ms | local $or_self->{dbh}{RaiseError} = 1; # spent 19.2ms making 2000 calls to DBI::common::EXISTS, avg 10µs/call
# spent 14.6ms making 2000 calls to DBD::_::common::EXISTS, avg 7µs/call
# spent 1.51ms making 2000 calls to DBI::common::STORE, avg 756ns/call
# spent 1.02ms making 2000 calls to DBI::common::FETCH, avg 512ns/call |
| 95 | |||||
| 96 | 2000 | 2.32ms | if ( $s_error ) { | ||
| 97 | require Carp; | ||||
| 98 | Carp::confess("transaction failed: $s_error"); | ||||
| 99 | $or_self->{dbh}->rollback(); | ||||
| 100 | } | ||||
| 101 | else { | ||||
| 102 | 2000 | 22.4s | 2000 | 22.4s | $or_self->{dbh}->commit(); # spent 22.4s making 2000 calls to DBI::db::commit, avg 11.2ms/call |
| 103 | } | ||||
| 104 | |||||
| 105 | 2000 | 278ms | 2000 | 214ms | $or_self->{dbh}{AutoCommit} = $or_self->{old_AutoCommit}; # spent 214ms making 2000 calls to DBI::common::STORE, avg 107µs/call |
| 106 | |||||
| 107 | } | ||||
| 108 | |||||
| 109 | 2000 | 24.3ms | return 1; | ||
| 110 | |||||
| 111 | } | ||||
| 112 | |||||
| 113 | 1 | 2µs | 1; | ||
| 114 | |||||
| 115 | __END__ |