]> git.sur5r.net Git - openldap/commitdiff
don't count operations per request if back-monitor is not built
authorPierangelo Masarati <ando@openldap.org>
Mon, 8 Apr 2002 19:13:13 +0000 (19:13 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 8 Apr 2002 19:13:13 +0000 (19:13 +0000)
servers/slapd/connection.c
servers/slapd/init.c
servers/slapd/proto-slap.h
servers/slapd/slap.h

index 5f4a463e27df1a1bbde43f315d6d04998ac3a71e..98972ba51899f53160d7335e4ca0dde36d6eecd6 100644 (file)
@@ -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 );
index 91482efc29a3d5dae606578d758bf1f45de92384..7bdae990b383fd7c82a123f2dca7c2f5143f91c4 100644 (file)
@@ -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;
index ba544ad56e787b6a45bac8fde305a5c996978ae9..f3d6a8b0b346478505805e4e893fbcae63879699 100644 (file)
@@ -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;
index 8d03483c63c4022745475fb228f4be420670034a..dcd97efb695c2dbb1ca1ed2ceca4f67466b5fd4f 100644 (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