]> git.sur5r.net Git - openldap/commitdiff
import ITS#2983 improvement from HEAD
authorPierangelo Masarati <ando@openldap.org>
Sat, 28 Feb 2004 14:52:54 +0000 (14:52 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 28 Feb 2004 14:52:54 +0000 (14:52 +0000)
CHANGES
servers/slapd/back-monitor/operation.c

diff --git a/CHANGES b/CHANGES
index 11dc45426507d8c38dacb4099912a08a59709e10..4265b588b8eb4551bde64346eaf3e29e2e6e7855 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 OpenLDAP 2.2 Change Log
 
 OpenLDAP 2.2.7 Engineering
+       Added total operation count in back-monitor (ITS#2983)
 
 OpenLDAP 2.2.6 Release
        Fixed slapd SASL callback handling (ITS#2926)
index d4ea6f9c352b2cee691d0a6d21a02c4acd08d739..0c23b779ebf73158027149bdf56471fe68f804ed 100644 (file)
@@ -54,6 +54,7 @@ monitor_subsys_ops_init(
        struct monitorentrypriv *mp;
        char                    buf[ BACKMONITOR_BUFSIZE ];
        int                     i;
+       struct berval           bv_zero = BER_BVC("0");
 
        assert( be != NULL );
 
@@ -76,6 +77,9 @@ monitor_subsys_ops_init(
                return( -1 );
        }
 
+       attr_merge_one( e_op, mi->mi_ad_monitorOpInitiated, &bv_zero, NULL );
+       attr_merge_one( e_op, mi->mi_ad_monitorOpCompleted, &bv_zero, NULL );
+
        e_tmp = NULL;
 
        for ( i = SLAP_OP_LAST; i-- > 0; ) {
@@ -163,7 +167,7 @@ monitor_subsys_ops_update(
 )
 {
        struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
-       long            nInitiated = -1, nCompleted = -1;
+       long            nInitiated = 0, nCompleted = 0;
        char            *rdnvalue;
        int             i;
        Attribute       *a;
@@ -174,17 +178,29 @@ monitor_subsys_ops_update(
 
        rdnvalue = e->e_dn + ( sizeof( "cn=" ) - 1 );
 
-       for (i = 0; i < SLAP_OP_LAST; i++ ) {
-               if ( strncmp( rdnvalue, bv_op[ i ].bv_val, 
-                                       bv_op[ i ].bv_len ) == 0 ) {
-                       nInitiated = num_ops_initiated_[ i ];
-                       nCompleted = num_ops_completed_[ i ];
-                       break;
+       if ( strncmp( rdnvalue, SLAPD_MONITOR_OPS_NAME,
+                               sizeof( SLAPD_MONITOR_OPS_NAME ) - 1 ) == 0 )
+       {
+               for ( i = 0; i < SLAP_OP_LAST; i++ ) {
+                       nInitiated += num_ops_initiated_[ i ];
+                       nCompleted += num_ops_completed_[ i ];
+               }
+               
+       } else {
+               for ( i = 0; i < SLAP_OP_LAST; i++ ) {
+                       if ( strncmp( rdnvalue, bv_op[ i ].bv_val, 
+                                               bv_op[ i ].bv_len ) == 0 )
+                       {
+                               nInitiated = num_ops_initiated_[ i ];
+                               nCompleted = num_ops_completed_[ i ];
+                               break;
+                       }
                }
-       }
 
-       if ( i == SLAP_OP_LAST ) {
-               return( 0 );
+               if ( i == SLAP_OP_LAST ) {
+                       /* not found ... */
+                       return( 0 );
+               }
        }
 
        a = attr_find( e->e_attrs, mi->mi_ad_monitorOpInitiated );