From c3c51142c341de91b9b4ebdf56f63c177c533528 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Apr 24 2013 18:22:12 +0000 Subject: Ticket #47348 - add etimes to per second/minute stats https://fedorahosted.org/389/ticket/47348 Reviewed by: mreynolds (Thanks!) Branch: 389-ds-base-1.3.1 Fix Description: Add an "ElapsedTime" column to the -m/-M output. This column is the cumulative etimes of all operations during that time period. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes (cherry picked from commit 9813b219ad2aa7b7194d9295dd529e12889a8534) --- diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl index 3b8adc5..efc5970 100755 --- a/ldap/admin/src/logconv.pl +++ b/ldap/admin/src/logconv.pl @@ -2042,7 +2042,7 @@ sub parseLineNormal if ($1 ne "0"){ $errorCount++;} else { $successCount++;} } - if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1);} + if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1); inc_stats_val('etime',$1,$s_stats,$m_stats); } if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){ if ($_ =~ / nentries= *([0-9]+)/i ){ writeFile($NENTRIES, $1); } } @@ -2197,6 +2197,7 @@ reset_stats_block $stats->{'anonbind'}=0; $stats->{'unbind'}=0; $stats->{'notesu'}=0; + $stats->{'etime'}=0; return; } @@ -2241,12 +2242,13 @@ print_stats_block $stats->{'bind'}, $stats->{'anonbind'}, $stats->{'unbind'}, - $stats->{'notesu'} ), + $stats->{'notesu'}, + $stats->{'etime'}), "\n" ); } else { $stats->{'fh'}->print( "Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,". - "Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed\n" + "Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed,ElapsedTime\n" ); } } @@ -2265,6 +2267,20 @@ inc_stats return; } +# like inc_stats, but increments the block counter with the given value e.g. +# 'statname1', val, statblock1, statblock2, ... +sub +inc_stats_val +{ + my $n = shift; + my $val = shift; + foreach(@_){ + $_->{$n} += $val + if exists $_->{$n}; + } + return; +} + sub displayBindReport {