d4e26e
From e8691d39f4fb0dc0a4ca12363430feb748984169 Mon Sep 17 00:00:00 2001
d4e26e
From: Mark Reynolds <mreynolds@redhat.com>
d4e26e
Date: Sun, 28 Jun 2020 15:46:59 -0400
d4e26e
Subject: [PATCH] Issue 51165 - add more logconv stats for the new access log
d4e26e
 keywords
d4e26e
d4e26e
Description:  Add "average" stats for wtime, optime, and etime
d4e26e
d4e26e
relates: https://pagure.io/389-ds-base/issue/51165
d4e26e
d4e26e
Reviewed by: firstyear(Thanks!)
d4e26e
---
d4e26e
 ldap/admin/src/logconv.pl | 152 +++++++++++++++++++++-----------------
d4e26e
 1 file changed, 86 insertions(+), 66 deletions(-)
d4e26e
d4e26e
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
d4e26e
index 250e9f9d4..375283085 100755
d4e26e
--- a/ldap/admin/src/logconv.pl
d4e26e
+++ b/ldap/admin/src/logconv.pl
d4e26e
@@ -1,5 +1,4 @@
d4e26e
 #!/usr/bin/env perl
d4e26e
-
d4e26e
 #
d4e26e
 # BEGIN COPYRIGHT BLOCK
d4e26e
 # Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
d4e26e
@@ -249,6 +248,12 @@ my $deleteStat;
d4e26e
 my $modrdnStat;
d4e26e
 my $compareStat;
d4e26e
 my $bindCountStat;
d4e26e
+my $totalEtime = 0.0;
d4e26e
+my $totalWtime = 0.0;
d4e26e
+my $totalOpTime = 0.0;
d4e26e
+my $etimeCount = 0;
d4e26e
+my $wtimeCount = 0;
d4e26e
+my $opTimeCount = 0;
d4e26e
 my %cipher = ();
d4e26e
 my @removefiles = ();
d4e26e
 
d4e26e
@@ -807,7 +812,7 @@ if ($totalTimeInNsecs == 0){
d4e26e
 #
d4e26e
 # Continue with standard report
d4e26e
 #
d4e26e
-print "Restarts:                     $serverRestartCount\n";
d4e26e
+print "Restarts:                      $serverRestartCount\n";
d4e26e
 
d4e26e
 if(%cipher){
d4e26e
 	print "Secure Protocol Versions:\n";
d4e26e
@@ -817,42 +822,42 @@ if(%cipher){
d4e26e
 	print "\n";
d4e26e
 }
d4e26e
 
d4e26e
-print "Peak Concurrent Connections:  $maxsimConnection\n";
d4e26e
-print "Total Operations:             $allOps\n";
d4e26e
-print "Total Results:                $allResults\n";
d4e26e
+print "Peak Concurrent Connections:   $maxsimConnection\n";
d4e26e
+print "Total Operations:              $allOps\n";
d4e26e
+print "Total Results:                 $allResults\n";
d4e26e
 my ($perf, $tmp);
d4e26e
 if ($allOps ne "0"){
d4e26e
-	print sprintf "Overall Performance:          %.1f%%\n\n" , ($perf = ($tmp = ($allResults / $allOps)*100) > 100 ? 100.0 : $tmp) ;
d4e26e
+	print sprintf "Overall Performance:           %.1f%%\n\n" , ($perf = ($tmp = ($allResults / $allOps)*100) > 100 ? 100.0 : $tmp) ;
d4e26e
 } else {
d4e26e
-	print "Overall Performance:          No Operations to evaluate\n\n";
d4e26e
+	print "Overall Performance:           No Operations to evaluate\n\n";
d4e26e
 }
d4e26e
 
d4e26e
 format STDOUT =
d4e26e
-Total Connections:            @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $connectionCount, $connStat,
d4e26e
- - LDAP Connections:          @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              ($connectionCount - $sslCount - $ldapiCount), $ldapConnStat
d4e26e
- - LDAPI Connections:         @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $ldapiCount, $ldapiConnStat
d4e26e
- - LDAPS Connections:         @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $sslCount, $sslConnStat
d4e26e
- - StartTLS Extended Ops:     @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $startTLSCount, $tlsConnStat
d4e26e
-
d4e26e
-Searches:                     @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $srchCount,   $searchStat,
d4e26e
-Modifications:                @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $modCount,    $modStat,
d4e26e
-Adds:                         @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $addCount,    $addStat,
d4e26e
-Deletes:                      @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $delCount,    $deleteStat,
d4e26e
-Mod RDNs:                     @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $modrdnCount, $modrdnStat,
d4e26e
-Compares:                     @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $cmpCount,    $compareStat,
d4e26e
-Binds:                        @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
-                              $bindCount,   $bindCountStat,
d4e26e
+Total Connections:             @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $connectionCount, $connStat,
d4e26e
+ - LDAP Connections:           @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               ($connectionCount - $sslCount - $ldapiCount), $ldapConnStat
d4e26e
+ - LDAPI Connections:          @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $ldapiCount, $ldapiConnStat
d4e26e
+ - LDAPS Connections:          @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $sslCount, $sslConnStat
d4e26e
+ - StartTLS Extended Ops:      @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $startTLSCount, $tlsConnStat
d4e26e
+
d4e26e
+Searches:                      @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $srchCount,   $searchStat,
d4e26e
+Modifications:                 @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $modCount,    $modStat,
d4e26e
+Adds:                          @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $addCount,    $addStat,
d4e26e
+Deletes:                       @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $delCount,    $deleteStat,
d4e26e
+Mod RDNs:                      @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $modrdnCount, $modrdnStat,
d4e26e
+Compares:                      @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $cmpCount,    $compareStat,
d4e26e
+Binds:                         @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
d4e26e
+                               $bindCount,   $bindCountStat,
d4e26e
 .
d4e26e
 write STDOUT;
d4e26e
 
d4e26e
@@ -863,23 +868,32 @@ sub dummy {
d4e26e
 }
d4e26e
 
d4e26e
 print "\n";
d4e26e
-print "Proxied Auth Operations:      $proxiedAuthCount\n";
d4e26e
-print "Persistent Searches:          $persistentSrchCount\n";
d4e26e
-print "Internal Operations:          $internalOpCount\n";
d4e26e
-print "Entry Operations:             $entryOpCount\n";
d4e26e
-print "Extended Operations:          $extopCount\n";
d4e26e
-print "Abandoned Requests:           $abandonCount\n";
d4e26e
-print "Smart Referrals Received:     $referralCount\n";
d4e26e
+if ($wtimeCount ne "0") {
d4e26e
+	print sprintf "Average wtime (wait time):     %.9f\n", $totalWtime / $wtimeCount;
d4e26e
+}
d4e26e
+if ($opTimeCount ne "0") {
d4e26e
+	print sprintf "Average optime (op time):      %.9f\n", $totalOpTime / $opTimeCount;
d4e26e
+}
d4e26e
+print sprintf "Average etime (elapsed time):  %.9f\n", $totalEtime / $etimeCount;
d4e26e
+
d4e26e
+print "\n";
d4e26e
+print "Proxied Auth Operations:       $proxiedAuthCount\n";
d4e26e
+print "Persistent Searches:           $persistentSrchCount\n";
d4e26e
+print "Internal Operations:           $internalOpCount\n";
d4e26e
+print "Entry Operations:              $entryOpCount\n";
d4e26e
+print "Extended Operations:           $extopCount\n";
d4e26e
+print "Abandoned Requests:            $abandonCount\n";
d4e26e
+print "Smart Referrals Received:      $referralCount\n";
d4e26e
 print "\n";
d4e26e
-print "VLV Operations:               $vlvCount\n";
d4e26e
-print "VLV Unindexed Searches:       $vlvNotesACount\n";
d4e26e
-print "VLV Unindexed Components:     $vlvNotesUCount\n";
d4e26e
-print "SORT Operations:              $vlvSortCount\n";
d4e26e
+print "VLV Operations:                $vlvCount\n";
d4e26e
+print "VLV Unindexed Searches:        $vlvNotesACount\n";
d4e26e
+print "VLV Unindexed Components:      $vlvNotesUCount\n";
d4e26e
+print "SORT Operations:               $vlvSortCount\n";
d4e26e
 print "\n";
d4e26e
-print "Entire Search Base Queries:   $objectclassTopCount\n";
d4e26e
-print "Paged Searches:               $pagedSearchCount\n";
d4e26e
-print "Unindexed Searches:           $unindexedSrchCountNotesA\n";
d4e26e
-print "Unindexed Components:         $unindexedSrchCountNotesU\n";
d4e26e
+print "Entire Search Base Queries:    $objectclassTopCount\n";
d4e26e
+print "Paged Searches:                $pagedSearchCount\n";
d4e26e
+print "Unindexed Searches:            $unindexedSrchCountNotesA\n";
d4e26e
+print "Unindexed Components:          $unindexedSrchCountNotesU\n";
d4e26e
 
d4e26e
 if ($verb eq "yes" || $usage =~ /u/ || $usage =~ /U/){
d4e26e
 	if ($unindexedSrchCountNotesA > 0){
d4e26e
@@ -1053,7 +1067,7 @@ if ($verb eq "yes" || $usage =~ /u/ || $usage =~ /U/){
d4e26e
     print "\n";
d4e26e
 }
d4e26e
 
d4e26e
-print "Invalid Attribute Filters:    $invalidFilterCount\n";
d4e26e
+print "Invalid Attribute Filters:     $invalidFilterCount\n";
d4e26e
 if ($invalidFilterCount > 0 && $verb eq "yes"){
d4e26e
     my $conn_hash = $hashes->{conn_hash};
d4e26e
     my $notesf_conn_op = $hashes->{notesf_conn_op};
d4e26e
@@ -1104,10 +1118,10 @@ if ($invalidFilterCount > 0 && $verb eq "yes"){
d4e26e
     print "\n";
d4e26e
 }
d4e26e
 
d4e26e
-print "FDs Taken:                    $fdTaken\n";
d4e26e
-print "FDs Returned:                 $fdReturned\n";
d4e26e
-print "Highest FD Taken:             $highestFdTaken\n\n";
d4e26e
-print "Broken Pipes:                 $brokenPipeCount\n";
d4e26e
+print "FDs Taken:                     $fdTaken\n";
d4e26e
+print "FDs Returned:                  $fdReturned\n";
d4e26e
+print "Highest FD Taken:              $highestFdTaken\n\n";
d4e26e
+print "Broken Pipes:                  $brokenPipeCount\n";
d4e26e
 if ($brokenPipeCount > 0){
d4e26e
 	my $rc = $hashes->{rc};
d4e26e
 	my @etext;
d4e26e
@@ -1121,7 +1135,7 @@ if ($brokenPipeCount > 0){
d4e26e
 	print "\n";
d4e26e
 }
d4e26e
 
d4e26e
-print "Connections Reset By Peer:    $connResetByPeerCount\n";
d4e26e
+print "Connections Reset By Peer:     $connResetByPeerCount\n";
d4e26e
 if ($connResetByPeerCount > 0){
d4e26e
 	my $src = $hashes->{src};
d4e26e
 	my @retext;
d4e26e
@@ -1135,7 +1149,7 @@ if ($connResetByPeerCount > 0){
d4e26e
 	print "\n";
d4e26e
 }
d4e26e
 
d4e26e
-print "Resource Unavailable:         $resourceUnavailCount\n";
d4e26e
+print "Resource Unavailable:          $resourceUnavailCount\n";
d4e26e
 if ($resourceUnavailCount > 0){
d4e26e
 	my $rsrc = $hashes->{rsrc};
d4e26e
 	my @rtext;
d4e26e
@@ -1147,27 +1161,27 @@ if ($resourceUnavailCount > 0){
d4e26e
 	}
d4e26e
 	print @rtext;
d4e26e
 }
d4e26e
-print "Max BER Size Exceeded:        $maxBerSizeCount\n";
d4e26e
+print "Max BER Size Exceeded:         $maxBerSizeCount\n";
d4e26e
 print "\n";
d4e26e
-print "Binds:                        $bindCount\n";
d4e26e
-print "Unbinds:                      $unbindCount\n";
d4e26e
-print "------------------------------";
d4e26e
+print "Binds:                         $bindCount\n";
d4e26e
+print "Unbinds:                       $unbindCount\n";
d4e26e
+print "-------------------------------";
d4e26e
 print "-" x length $bindCount;
d4e26e
 print "\n";
d4e26e
-print " - LDAP v2 Binds:             $v2BindCount\n";
d4e26e
-print " - LDAP v3 Binds:             $v3BindCount\n";
d4e26e
-print " - AUTOBINDs(LDAPI):          $autobindCount\n";
d4e26e
-print " - SSL Client Binds:          $sslClientBindCount\n";
d4e26e
-print " - Failed SSL Client Binds:   $sslClientFailedCount\n";
d4e26e
-print " - SASL Binds:                $saslBindCount\n";
d4e26e
+print " - LDAP v2 Binds:              $v2BindCount\n";
d4e26e
+print " - LDAP v3 Binds:              $v3BindCount\n";
d4e26e
+print " - AUTOBINDs(LDAPI):           $autobindCount\n";
d4e26e
+print " - SSL Client Binds:           $sslClientBindCount\n";
d4e26e
+print " - Failed SSL Client Binds:    $sslClientFailedCount\n";
d4e26e
+print " - SASL Binds:                 $saslBindCount\n";
d4e26e
 if ($saslBindCount > 0){
d4e26e
 	my $saslmech = $hashes->{saslmech};
d4e26e
 	foreach my $saslb ( sort {$saslmech->{$b} <=> $saslmech->{$a} } (keys %{$saslmech}) ){
d4e26e
 		printf "   - %-4s: %s\n",$saslb, $saslmech->{$saslb};
d4e26e
 	}
d4e26e
 }
d4e26e
-print " - Directory Manager Binds:   $rootDNBindCount\n";
d4e26e
-print " - Anonymous Binds:           $anonymousBindCount\n";
d4e26e
+print " - Directory Manager Binds:    $rootDNBindCount\n";
d4e26e
+print " - Anonymous Binds:            $anonymousBindCount\n";
d4e26e
 
d4e26e
 ##########################################################################
d4e26e
 #                       Verbose Logging Section                          #
d4e26e
@@ -2572,16 +2586,22 @@ sub parseLineNormal
d4e26e
 	}
d4e26e
 	if ($_ =~ /etime= *([0-9.]+)/ ) { 
d4e26e
 		my $etime_val = $1;
d4e26e
+		$totalEtime = $totalEtime + $1;
d4e26e
+		$etimeCount++;
d4e26e
 		if ($usage =~ /t/i || $verb eq "yes"){ $hashes->{etime}->{$etime_val}++; }
d4e26e
 		if ($reportStats){ inc_stats_val('etime',$etime_val,$s_stats,$m_stats); }
d4e26e
 	}
d4e26e
 	if ($_ =~ /wtime= *([0-9.]+)/ ) {
d4e26e
 		my $wtime_val = $1;
d4e26e
+		$totalWtime = $totalWtime + $1;
d4e26e
+		$wtimeCount++;
d4e26e
 		if ($usage =~ /t/i || $verb eq "yes"){ $hashes->{wtime}->{$wtime_val}++; }
d4e26e
 		if ($reportStats){ inc_stats_val('wtime',$wtime_val,$s_stats,$m_stats); }
d4e26e
 	}
d4e26e
 	if ($_ =~ /optime= *([0-9.]+)/ ) {
d4e26e
 		my $optime_val = $1;
d4e26e
+		$totalOpTime = $totalOpTime + $1;
d4e26e
+		$opTimeCount++;
d4e26e
 		if ($usage =~ /t/i || $verb eq "yes"){ $hashes->{optime}->{$optime_val}++; }
d4e26e
 		if ($reportStats){ inc_stats_val('optime',$optime_val,$s_stats,$m_stats); }
d4e26e
 	}
d4e26e
-- 
d4e26e
2.30.2
d4e26e