From: Kurt Zeilenga Date: Fri, 26 Mar 1999 02:51:33 +0000 (+0000) Subject: Reenable counters. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~334 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=668c8da98014f5323cc3684316dc1453adf2c169;p=openldap Reenable counters. --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index aec09ae690..b84f0b5d89 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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 ); diff --git a/servers/slapd/init.c b/servers/slapd/init.c index acbee9ef63..c807014185 100644 --- a/servers/slapd/init.c +++ b/servers/slapd/init.c @@ -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( ¤ttime_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 ); diff --git a/servers/slapd/monitor.c b/servers/slapd/monitor.c index 035ef9769d..658db39791 100644 --- a/servers/slapd/monitor.c +++ b/servers/slapd/monitor.c @@ -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 ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index b4baf447f8..7907d6a623 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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; diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 2a041bf66b..311a355f18 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -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 ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 72503912e1..6ffc1a827a 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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)