Skip to content
Snippets Groups Projects
Commit c22f10f4 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

don't count operations per request if back-monitor is not built

parent b7729877
No related branches found
No related tags found
No related merge requests found
......@@ -909,19 +909,26 @@ void connection_done( Connection *c )
* calls the appropriate stub to handle it.
*/
#ifdef SLAPD_MONITOR
#define INCR_OP(var,index) \
do { \
ldap_pvt_thread_mutex_lock( &num_ops_mutex ); \
(var)[(index)]++; \
ldap_pvt_thread_mutex_unlock( &num_ops_mutex ); \
} while (0)
#else /* !SLAPD_MONITOR */
#define INCR_OP(var,index)
#endif /* !SLAPD_MONITOR */
static void *
connection_operation( void *arg_v )
{
int rc;
struct co_arg *arg = arg_v;
ber_tag_t tag = arg->co_op->o_tag, oldtag = tag;
ber_tag_t tag = arg->co_op->o_tag;
#ifdef SLAPD_MONITOR
ber_tag_t oldtag = tag;
#endif /* SLAPD_MONITOR */
Connection *conn = arg->co_conn;
ldap_pvt_thread_mutex_lock( &num_ops_mutex );
......@@ -1011,12 +1018,15 @@ connection_operation( void *arg_v )
break;
}
#ifdef SLAPD_MONITOR
oldtag = tag;
#endif /* SLAPD_MONITOR */
if( rc == SLAPD_DISCONNECT ) tag = LBER_ERROR;
operations_error:
ldap_pvt_thread_mutex_lock( &num_ops_mutex );
num_ops_completed++;
#ifdef SLAPD_MONITOR
switch (oldtag) {
case LDAP_REQ_BIND:
num_ops_completed_[SLAP_OP_BIND]++;
......@@ -1049,6 +1059,7 @@ operations_error:
num_ops_completed_[SLAP_OP_EXTENDED]++;
break;
}
#endif /* SLAPD_MONITOR */
ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
......
......@@ -44,9 +44,11 @@ ldap_pvt_thread_mutex_t passwd_mutex;
#endif
unsigned long num_ops_initiated = 0;
unsigned long num_ops_initiated_[SLAP_OP_LAST];
unsigned long num_ops_completed = 0;
#ifdef SLAPD_MONITOR
unsigned long num_ops_initiated_[SLAP_OP_LAST];
unsigned long num_ops_completed_[SLAP_OP_LAST];
#endif /* SLAPD_MONITOR */
ldap_pvt_thread_mutex_t num_ops_mutex;
unsigned long num_entries_sent;
......
......@@ -1015,9 +1015,11 @@ LDAP_SLAPD_V (unsigned long) num_refs_sent;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) num_ops_mutex;
LDAP_SLAPD_V (unsigned long) num_ops_completed;
LDAP_SLAPD_V (unsigned long) num_ops_completed_[SLAP_OP_LAST];
LDAP_SLAPD_V (unsigned long) num_ops_initiated;
#ifdef SLAPD_MONITOR
LDAP_SLAPD_V (unsigned long) num_ops_completed_[SLAP_OP_LAST];
LDAP_SLAPD_V (unsigned long) num_ops_initiated_[SLAP_OP_LAST];
#endif /* SLAPD_MONITOR */
LDAP_SLAPD_V (char *) slapd_pid_file;
LDAP_SLAPD_V (char *) slapd_args_file;
......
......@@ -1599,6 +1599,7 @@ typedef struct slap_listener {
#define sl_addr sl_sa.sa_in_addr
} Listener;
#ifdef SLAPD_MONITOR
/*
* Operation indices
*/
......@@ -1615,6 +1616,7 @@ enum {
SLAP_OP_EXTENDED,
SLAP_OP_LAST
};
#endif /* SLAPD_MONITOR */
LDAP_END_DECL
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment