[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/linuxaux/opt/perl/bin/ -> dbilogstrip (source)

   1  #!/opt/perl/bin/perl
   2  
   3  eval 'exec /opt/perl/bin/perl  -S $0 $1+"$@"}'
   4      if 0; # not running under some shell
   5  
   6  =head1 NAME
   7  
   8  dbilogstrip - filter to normalize DBI trace logs for diff'ing
   9  
  10  =head1 SYNOPSIS
  11  
  12  Read DBI trace file C<dbitrace.log> and write out a stripped version to C<dbitrace_stripped.log>
  13  
  14    dbilogstrip dbitrace.log > dbitrace_stripped.log
  15  
  16  Run C<yourscript.pl> twice, each with different sets of arguments, with
  17  DBI_TRACE enabled. Filter the output and trace through C<dbilogstrip> into a
  18  separate file for each run. Then compare using diff. (This example assumes
  19  you're using a standard shell.)
  20  
  21    DBI_TRACE=2 perl yourscript.pl ...args1... 2>&1 | dbilogstrip > dbitrace1.log
  22    DBI_TRACE=2 perl yourscript.pl ...args2... 2>&1 | dbilogstrip > dbitrace2.log
  23    diff -u dbitrace1.log dbitrace2.log
  24  
  25  =head1 DESCRIPTION
  26  
  27  Replaces any hex addresses, e.g, C<0x128f72ce> with C<0xN>.
  28  
  29  Replaces any references to process id or thread id, like C<pid#6254> with C<pidN>.
  30  
  31  So a DBI trace line like this:
  32  
  33    -> STORE for DBD::DBM::st (DBI::st=HASH(0x19162a0)~0x191f9c8 'f_params' ARRAY(0x1922018)) thr#1800400
  34  
  35  will look like this:
  36  
  37    -> STORE for DBD::DBM::st (DBI::st=HASH(0xN)~0xN 'f_params' ARRAY(0xN)) thrN
  38  
  39  =cut
  40  
  41  use strict;
  42  
  43  while (<>) {
  44      # normalize hex addresses: 0xDEADHEAD => 0xN
  45      s/ \b 0x [0-9a-f]+ /0xN/gx;
  46      # normalize process and thread id number
  47      s/ \b (pid|tid|thr) \W? \d+ /$1}N/gx;
  48  
  49  } continue {
  50      print or die "-p destination: $!\n";
  51  }
  52  
  53  


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1