Put this script into your log directory or (PATH) and turn bone logs on.

  1. Delete the old and useless logs.
  2. Run the script before you make any action.
  3. Do any action on the front end.
  4. Run the script again - you get a statistics, what statements were executed and how many times.
#!/bin/perl
# Ondrej Brablc
use strict;
use File::glob;
 
my @FILES = grep { ! -f "${_}line" } sort glob "allpeers-*.log";
 
my %STAT;
 
my $lastFile = "";
 
foreach my $file (@FILES)
{
    my $skip = 0;
 
    if (-f "${file}skip")
    {
        $skip = int ( `cat ${file}skip` );
    }
 
    my $line = 0;
    $lastFile = $file;
    open( FILE, $file);
    while (<FILE>)
    {
        $line++;
 
        next if $line <= $skip;
 
        next unless /SQL processing begun for: /;
        next if /BEGIN IMMEDIATE/;
        next if /COMMIT/;
 
        /SQL processing begun for: (.*?)[;]?, apDatabaseService.cpp/;
        $STAT{$1}++;
    }
    close FILE;
    open ( LINE, ">${file}line");
    print LINE "$line\n";
    close LINE;
}
 
if ($lastFile ne "")
{
    system("mv -f ${lastFile}line ${lastFile}skip");
}
 
foreach my $sql (sort { $STAT{$b} <=> $STAT{$a} } keys %STAT)
{
    printf "%05d: %s\n", ($STAT{$sql},$sql);
}
 
src/hack/grepsql.txt · Last modified: 2007/03/06 18:13 by jakub
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki