diff options
author | Yorhel <git@yorhel.nl> | 2020-07-30 10:47:50 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-07-30 10:47:52 +0200 |
commit | 09dfb2c285dac6a5a2e505aec6d934ebbed3fce8 (patch) | |
tree | 101e251f30581ea4a77a3c0c3e4291cf724b5f1f | |
parent | 55ed28a8dcc7fe5f22fe5259c5a518233c2b8bdc (diff) |
tracing: Keep track of whether the page transaction has a txid
This seems to be the most reliable measurement of "did this page modify
the database in any way?", allowing me to get a better feel of the ratio
between read-only and read-write pages.
-rw-r--r-- | sql/schema.sql | 1 | ||||
-rwxr-xr-x | util/vndb.pl | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sql/schema.sql b/sql/schema.sql index 0ed88425..fce40881 100644 --- a/sql/schema.sql +++ b/sql/schema.sql @@ -732,6 +732,7 @@ CREATE TABLE trace_log ( sql_num integer, sql_time float, perl_time float, + has_txn boolean, loggedin boolean, elm_mods text[] ); diff --git a/util/vndb.pl b/util/vndb.pl index 5c6d5a6a..49e27b6a 100755 --- a/util/vndb.pl +++ b/util/vndb.pl @@ -130,8 +130,8 @@ if(config->{trace_log}) { } } no warnings 'redefine'; - my $x = \&TUWF::register; *TUWF::register = wrap($x);# sub { $x->(map ref($_) eq 'CODE' ? wrap($_) : $_, @_) }; - my $y = \&TUWF::any; *TUWF::any = wrap($y);# sub { $y->(map ref($_) eq 'CODE' ? wrap($_) : $_, @_) }; + my $x = \&TUWF::register; *TUWF::register = wrap($x); + my $y = \&TUWF::any; *TUWF::any = wrap($y); } TUWF::load_recursive('VNDB::Util', 'VNDB::DB', 'VNDB::Handler'); @@ -151,6 +151,7 @@ TUWF::hook after => sub { sql_num => scalar grep($_->[0] ne 'ping/rollback' && $_->[0] ne 'commit', tuwf->{_TUWF}{DB}{queries}->@*), sql_time => $sqlt, perl_time => time() - tuwf->req->{trace_start}, + has_txn => VNWeb::DB::sql('txid_current_if_assigned() IS NOT NULL'), loggedin => auth?1:0, elm_mods => '{'.join(',', sort keys %elm).'}' }); |