"connection_get(%d): got connid=%ld\n",
s, c->c_connid, 0 );
+ c->c_n_get++;
+
assert( c->c_struct_state == SLAP_C_USED );
assert( c->c_conn_state != SLAP_C_INVALID );
assert( ber_pvt_sb_in_use( c->c_sb ) );
c->c_client_addr = ch_strdup( addr );
c->c_n_ops_received = 0;
-#ifdef LDAP_COUNTERS
c->c_n_ops_executing = 0;
c->c_n_ops_pending = 0;
c->c_n_ops_completed = 0;
-#endif
+
+ c->c_n_get = 0;
+ c->c_n_read = 0;
+ c->c_n_write = 0;
c->c_activitytime = c->c_starttime = slap_get_time();
ber_tag_t tag = arg->co_op->o_tag;
Connection *conn = arg->co_conn;
-#ifdef LDAP_COUNTERS
ldap_pvt_thread_mutex_lock( &num_ops_mutex );
num_ops_initiated++;
ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
-#endif
switch ( tag ) {
case LDAP_REQ_BIND:
break;
}
-#ifdef LDAP_COUNTERS
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_n_ops_executing--;
conn->c_n_ops_completed++;
-#endif
slap_op_remove( &conn->c_ops, arg->co_op );
slap_op_free( arg->co_op );
return -1;
}
+ c->c_n_read++;
+
if( c->c_conn_state == SLAP_C_CLOSING ) {
Debug( LDAP_DEBUG_TRACE,
"connection_read(%d): closing, ignoring input for id=%ld\n",
|| conn->c_conn_state == SLAP_C_CLOSING )
{
Debug( LDAP_DEBUG_ANY, "deferring operation\n", 0, 0, 0 );
+ conn->c_n_ops_pending++;
slap_op_add( &conn->c_pending_ops, op );
} else {
+ conn->c_n_ops_executing++;
connection_op_activate( conn, op );
}
/* pending operations should not be marked for abandonment */
assert(!op->o_abandon);
+ conn->c_n_ops_pending--;
+ conn->c_n_ops_executing++;
+
connection_op_activate( conn, op );
if ( conn->c_conn_state == SLAP_C_BINDING ) {
return -1;
}
+ c->c_n_write++;
+
Debug( LDAP_DEBUG_TRACE,
"connection_write(%d): waking output for id=%ld\n",
s, c->c_connid, 0 );
int nconns, nwritewaiters, nreadwaiters;
struct tm *ltm;
char *p;
-#ifdef LDAP_COUNTERS
- int i;
- char buf2[22]
- char buf3[22]
+ char buf2[22];
+ char buf3[22];
Connection *c;
int connindex;
-#endif
time_t currenttime;
vals[0] = &val;
nwritewaiters = 0;
nreadwaiters = 0;
-#ifdef LDAP_COUNTERS
/* loop through the connections */
for ( c = connection_first( &connindex );
c != NULL;
ltm = gmtime( &c->c_starttime );
strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
- ltm = gmtime( &c->.c_activitytime );
- strftime( buf3, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
+ ltm = gmtime( &c->c_activitytime );
+ strftime( buf3, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
#else
ltm = localtime( &c->.c_starttime );
strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
- ltm = localtime( &c->.c_activitytime );
+ ltm = localtime( &c->c_activitytime );
strftime( buf3, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
#endif
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
- sprintf( buf, "%d : %s : %d : %d : %s : %s%s%s%s : %s", i,
- 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_currentber ? "r" : "",
- c[i].c_writewaiter ? "w" : "",
- c[i].c_ops != NULL ? "x" : "",
- c[i].c_pending_ops != NULL ? "p" : ""
+ sprintf( buf,
+ "%ld : %ld "
+ ": %ld/%ld/%ld/%ld "
+ ": %ld/%ld/%ld "
+ ": %s%s%s%s "
+ ": %s : %s : %s "
+ ": %s : %s",
+
+ c->c_connid,
+ (long) c->c_protocol,
+
+ c->c_n_ops_received, c->c_n_ops_executing,
+ c->c_n_ops_pending, c->c_n_ops_completed,
+
+ /* add low-level counters here */
+ c->c_n_get, c->c_n_read, c->c_n_write,
+
+ c->c_currentber ? "r" : "",
+ c->c_writewaiter ? "w" : "",
+ c->c_ops != NULL ? "x" : "",
+ c->c_pending_ops != NULL ? "p" : "",
+
+ c->c_cdn ? c->c_cdn : "<anonymous>",
+ c->c_client_addr ? c->c_client_addr : "unknown",
+ c->c_client_name ? c->c_client_name : "unknown",
+
+ buf2,
buf3
);
attr_merge( e, "connection", vals );
}
connection_done(c);
-#endif
sprintf( buf, "%d", nconns );
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "readwaiters", vals );
-#ifdef LDAP_COUNTERS
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, "bytessent", vals );
-#endif
currenttime = slap_get_time();