Commit 668c8da9 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Reenable counters.

parent 10d7f354
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment