From: Ondrej Kuznik Date: Wed, 8 Feb 2012 13:14:11 +0000 (+0100) Subject: ITS#7182 Introduce the variables for operation monitoring. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fb2d235615372ef43f8f86e6102d00ac2397fcbd;p=openldap ITS#7182 Introduce the variables for operation monitoring. Only completed operations are considered for now, this can be changed if needed. --- diff --git a/servers/slapd/back-ldap/back-ldap.h b/servers/slapd/back-ldap/back-ldap.h index 6bf87020c2..0ae3d48a94 100644 --- a/servers/slapd/back-ldap/back-ldap.h +++ b/servers/slapd/back-ldap/back-ldap.h @@ -409,6 +409,9 @@ typedef struct ldapinfo_t { time_t li_conn_ttl; time_t li_idle_timeout; time_t li_timeout[ SLAP_OP_LAST ]; + + ldap_pvt_thread_mutex_t li_counter_mutex; + ldap_pvt_mp_t li_ops_completed[SLAP_OP_LAST]; } ldapinfo_t; #define LDAP_ERR_OK(err) ((err) == LDAP_SUCCESS || (err) == LDAP_COMPARE_FALSE || (err) == LDAP_COMPARE_TRUE) diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c index 1a79ac8f79..6c4e7e86a2 100644 --- a/servers/slapd/back-ldap/init.c +++ b/servers/slapd/back-ldap/init.c @@ -180,6 +180,11 @@ ldap_back_db_init( Backend *be, ConfigReply *cr ) } li->li_conn_priv_max = LDAP_BACK_CONN_PRIV_DEFAULT; + ldap_pvt_thread_mutex_init( &li->li_counter_mutex ); + for ( i = 0; i < SLAP_OP_LAST; i++ ) { + ldap_pvt_mp_init( li->li_ops_completed[ i ] ); + } + be->be_private = li; SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_NOLASTMOD; @@ -336,6 +341,11 @@ ldap_back_db_destroy( Backend *be, ConfigReply *cr ) ldap_pvt_thread_mutex_unlock( &li->li_conninfo.lai_mutex ); ldap_pvt_thread_mutex_destroy( &li->li_conninfo.lai_mutex ); ldap_pvt_thread_mutex_destroy( &li->li_uri_mutex ); + + for ( i = 0; i < SLAP_OP_LAST; i++ ) { + ldap_pvt_mp_clear( li->li_ops_completed[ i ] ); + } + ldap_pvt_thread_mutex_destroy( &li->li_counter_mutex ); } ch_free( be->be_private );