From: Pierangelo Masarati Date: Mon, 8 Apr 2002 19:13:13 +0000 (+0000) Subject: don't count operations per request if back-monitor is not built X-Git-Tag: OPENLDAP_REL_ENG_2_MP~238 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c22f10f4ca38a955e2c9977f43ff64372ddbfd97;p=openldap don't count operations per request if back-monitor is not built --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 5f4a463e27..98972ba518 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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 ); diff --git a/servers/slapd/init.c b/servers/slapd/init.c index 91482efc29..7bdae990b3 100644 --- a/servers/slapd/init.c +++ b/servers/slapd/init.c @@ -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; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index ba544ad56e..f3d6a8b0b3 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 8d03483c63..dcd97efb69 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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