]> git.sur5r.net Git - openldap/commitdiff
Reenable counters.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 26 Mar 1999 02:51:33 +0000 (02:51 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 26 Mar 1999 02:51:33 +0000 (02:51 +0000)
servers/slapd/connection.c
servers/slapd/init.c
servers/slapd/monitor.c
servers/slapd/proto-slap.h
servers/slapd/result.c
servers/slapd/slap.h

index aec09ae6905c2032bcc1d0edbd9512bed75d3bfc..b84f0b5d8992cee59cb625ed13eb76e238ad54f1 100644 (file)
@@ -428,9 +428,9 @@ connection_operation( void *arg_v )
        Connection *conn = arg->co_conn;
 
 #ifdef LDAP_COUNTERS
-       ldap_pvt_thread_mutex_lock( &ops_mutex );
-       ops_initiated++;
-       ldap_pvt_thread_mutex_unlock( &ops_mutex );
+       ldap_pvt_thread_mutex_lock( &num_ops_mutex );
+       num_ops_initiated++;
+       ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
 #endif
 
        switch ( tag ) {
@@ -486,15 +486,15 @@ connection_operation( void *arg_v )
        }
 
 #ifdef LDAP_COUNTERS
-       ldap_pvt_thread_mutex_lock( &ops_mutex );
-       ops_completed++;
-       ldap_pvt_thread_mutex_unlock( &ops_mutex );
+       ldap_pvt_thread_mutex_lock( &num_ops_mutex );
+       num_ops_completed++;
+       ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
 #endif
 
        ldap_pvt_thread_mutex_lock( &conn->c_mutex );
 
 #ifdef LDAP_COUNTERS
-       conn->c_ops_completed++;
+       conn->c_n_ops_completed++;
 #endif
 
        slap_op_remove( &conn->c_ops, arg->co_op );
index acbee9ef631c1fd0c82a418dd237ccdf296b353f..c807014185bd5547b4330c5395e7ebc3958471c0 100644 (file)
@@ -40,9 +40,9 @@ ldap_pvt_thread_mutex_t       crypt_mutex;
 #endif
 
 int                            num_conns;
-long                   ops_initiated;
-long                   ops_completed;
-ldap_pvt_thread_mutex_t        ops_mutex;
+long                   num_ops_initiated;
+long                   num_ops_completed;
+ldap_pvt_thread_mutex_t        num_ops_mutex;
 
 long                   num_entries_sent;
 long                   num_bytes_sent;
@@ -96,7 +96,7 @@ slap_init( int mode, char *name )
                        ldap_pvt_thread_mutex_init( &currenttime_mutex );
                        ldap_pvt_thread_mutex_init( &entry2str_mutex );
                        ldap_pvt_thread_mutex_init( &replog_mutex );
-                       ldap_pvt_thread_mutex_init( &ops_mutex );
+                       ldap_pvt_thread_mutex_init( &num_ops_mutex );
                        ldap_pvt_thread_mutex_init( &num_sent_mutex );
 
                        ldap_pvt_thread_mutex_init( &gmtime_mutex );
index 035ef9769df9d3e3df13794128f8feb7f8476c97..658db39791a977e6a79b6b1016487a497a4c1900 100644 (file)
@@ -87,12 +87,12 @@ monitor_info( Connection *conn, Operation *op )
                ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 
                sprintf( buf, "%d : %s : %d : %d : %s : %s%s%s%s", i,
-                   buf2, c[i].c_ops_received, c[i].c_ops_completed,
+                   buf2, c[i].c_n_ops_received, c[i].c_n_ops_completed,
                    c[i].c_cdn ? c[i].c_cdn : "NULLDN",
-                   c[i].c_gettingber ? "r" : "",
+                   c[i].c_currentber ? "r" : "",
                    c[i].c_writewaiter ? "w" : "",
-                   c[i].c_ops_executing ? "x" : "",
-                   c[i].c_ops_pending ? "p" : ""
+                   c[i].c_ops != NULL ? "x" : "",
+                   c[i].c_pending_ops != NULL ? "p" : ""
                );
 
                val.bv_val = buf;
@@ -128,22 +128,30 @@ monitor_info( Connection *conn, Operation *op )
        attr_merge( e, "readwaiters", vals );
 
 #ifdef LDAP_COUNTERS
-       sprintf( buf, "%ld", ops_initiated );
+       ldap_pvt_thread_mutex_lock(&num_ops_mutex);
+       sprintf( buf, "%ld", num_ops_initiated );
+       ldap_pvt_thread_mutex_unlock(&num_ops_mutex);
        val.bv_val = buf;
        val.bv_len = strlen( buf );
        attr_merge( e, "opsinitiated", vals );
 
-       sprintf( buf, "%ld", ops_completed );
+       ldap_pvt_thread_mutex_lock(&num_ops_mutex);
+       sprintf( buf, "%ld", num_ops_completed );
+       ldap_pvt_thread_mutex_unlock(&num_ops_mutex);
        val.bv_val = buf;
        val.bv_len = strlen( buf );
        attr_merge( e, "opscompleted", vals );
 
+       ldap_pvt_thread_mutex_lock(&num_sent_mutex);
        sprintf( buf, "%ld", num_entries_sent );
+       ldap_pvt_thread_mutex_unlock(&num_sent_mutex);
        val.bv_val = buf;
        val.bv_len = strlen( buf );
        attr_merge( e, "entriessent", vals );
 
+       ldap_pvt_thread_mutex_lock(&num_sent_mutex);
        sprintf( buf, "%ld", num_bytes_sent );
+       ldap_pvt_thread_mutex_unlock(&num_sent_mutex);
        val.bv_val = buf;
        val.bv_len = strlen( buf );
        attr_merge( e, "bytessent", vals );
index b4baf447f8a984a4a1bef585fb51ffedf0b75a1b..7907d6a623cddbf1ccd05ab2a5c822d15771e70f 100644 (file)
@@ -273,16 +273,13 @@ extern int                global_schemacheck;
 extern int             lber_debug;
 extern int             ldap_syslog;
 
-#ifdef LDAP_COUNTERS
 extern ldap_pvt_thread_mutex_t num_sent_mutex;
 extern long            num_bytes_sent;
-
 extern long            num_entries_sent;
 
-extern ldap_pvt_thread_mutex_t ops_mutex;
-extern long            ops_completed;
-extern long            ops_initiated;
-#endif
+extern ldap_pvt_thread_mutex_t num_ops_mutex;
+extern long            num_ops_completed;
+extern long            num_ops_initiated;
 
 extern char   *slapd_pid_file;
 extern char   *slapd_args_file;
index 2a041bf66b55ad4201e8bd1d766580a7363826d0..311a355f18a94d64bb7fa1b9d989838f8856761a 100644 (file)
@@ -122,11 +122,9 @@ send_ldap_result2(
        ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
        ldap_pvt_thread_mutex_unlock( &conn->c_write_mutex );
 
-#ifdef LDAP_COUNTERS
        ldap_pvt_thread_mutex_lock( &num_sent_mutex );
        num_bytes_sent += bytes;
        ldap_pvt_thread_mutex_unlock( &num_sent_mutex );
-#endif
 
        Statslog( LDAP_DEBUG_STATS,
            "conn=%d op=%d RESULT err=%d tag=%lu nentries=%d\n", conn->c_connid,
@@ -352,12 +350,10 @@ send_search_entry(
        ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
        ldap_pvt_thread_mutex_unlock( &conn->c_write_mutex );
 
-#ifdef LDAP_COUNTERS
        ldap_pvt_thread_mutex_lock( &num_sent_mutex );
        num_bytes_sent += bytes;
        num_entries_sent++;
        ldap_pvt_thread_mutex_unlock( &num_sent_mutex );
-#endif
 
        Statslog( LDAP_DEBUG_STATS2, "conn=%d op=%d ENTRY dn=\"%s\"\n",
            conn->c_connid, op->o_opid, e->e_dn, 0, 0 );
index 72503912e18086ccc685a96844852bd5c85a90ec..6ffc1a827a47ee5de144245cb8d4ee616894b116 100644 (file)
@@ -446,11 +446,9 @@ typedef struct slap_conn {
        int             c_writewaiter;  /* true if writer is waiting */
 
        long    c_n_ops_received;               /* num of ops received (next op_id) */
-#ifdef LDAP_COUNTERS
        long    c_n_ops_executing;      /* num of ops currently executing */
        long    c_n_ops_pending;                /* num of ops pending execution */
        long    c_n_ops_completed;      /* num of ops completed */
-#endif
 } Connection;
 
 #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)