]> git.sur5r.net Git - openldap/commitdiff
More timing for performance testing. Re-introduction of cache.c_mutex.
authorKurt Spanier <ksp@openldap.org>
Mon, 22 Feb 1999 11:22:44 +0000 (11:22 +0000)
committerKurt Spanier <ksp@openldap.org>
Mon, 22 Feb 1999 11:22:44 +0000 (11:22 +0000)
17 files changed:
servers/slapd/back-bdb2/add.c
servers/slapd/back-bdb2/back-bdb2.h
servers/slapd/back-bdb2/bind.c
servers/slapd/back-bdb2/cache.c
servers/slapd/back-bdb2/compare.c
servers/slapd/back-bdb2/dbcache.c
servers/slapd/back-bdb2/delete.c
servers/slapd/back-bdb2/group.c
servers/slapd/back-bdb2/init.c
servers/slapd/back-bdb2/modify.c
servers/slapd/back-bdb2/modrdn.c
servers/slapd/back-bdb2/porter.c
servers/slapd/back-bdb2/proto-back-bdb2.h
servers/slapd/back-bdb2/search.c
servers/slapd/back-bdb2/startup.c
servers/slapd/back-bdb2/timing.c
servers/slapd/back-bdb2/txn.c

index 6d56b48012408d27f47ae3bb10e362b45d784dc7..e04f77591fc66852c28001e61335f1c0ff029257 100644 (file)
@@ -23,6 +23,7 @@ bdb2i_back_add_internal(
        char            *pdn;
        Entry           *p = NULL;
        int                     rc; 
+       struct timeval  time1;
 
        Debug(LDAP_DEBUG_ARGS, "==> bdb2i_back_add: %s\n", e->e_dn, 0, 0);
 
@@ -106,8 +107,12 @@ bdb2i_back_add_internal(
        /*
         * Try to add the entry to the cache, assign it a new dnid.
         */
+       bdb2i_start_timing( be->bd_info, &time1 );
+
        rc = bdb2i_cache_add_entry_rw( &li->li_cache, e, CACHE_WRITE_LOCK );
 
+       bdb2i_stop_timing( be->bd_info, time1, "ADD-CACHE", conn, op );
+
        if ( rc != 0 ) {
                if( p != NULL) {
                        /* free parent and writer lock */
@@ -138,37 +143,57 @@ bdb2i_back_add_internal(
         * add it to the id2children index for the parent
         */
 
+       bdb2i_start_timing( be->bd_info, &time1 );
+
        if ( bdb2i_id2children_add( be, p, e ) != 0 ) {
                Debug( LDAP_DEBUG_TRACE, "bdb2i_id2children_add failed\n", 0,
                    0, 0 );
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
 
+               bdb2i_stop_timing( be->bd_info, time1, "ADD-ID2CHILDREN", conn, op );
+
                goto return_results;
        }
 
+       bdb2i_stop_timing( be->bd_info, time1, "ADD-ID2CHILDREN", conn, op );
+
        /*
         * Add the entry to the attribute indexes, then add it to
         * the id2children index, dn2id index, and the id2entry index.
         */
 
+       bdb2i_start_timing( be->bd_info, &time1 );
+
        /* attribute indexes */
        if ( bdb2i_index_add_entry( be, e ) != 0 ) {
                Debug( LDAP_DEBUG_TRACE, "bdb2i_index_add_entry failed\n", 0,
                    0, 0 );
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
 
+               bdb2i_stop_timing( be->bd_info, time1, "ADD-INDEX", conn, op );
+
                goto return_results;
        }
 
+       bdb2i_stop_timing( be->bd_info, time1, "ADD-INDEX", conn, op );
+
+       bdb2i_start_timing( be->bd_info, &time1 );
+
        /* dn2id index */
        if ( bdb2i_dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) {
                Debug( LDAP_DEBUG_TRACE, "bdb2i_dn2id_add failed\n", 0,
                    0, 0 );
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
 
+               bdb2i_stop_timing( be->bd_info, time1, "ADD-DN2ID", conn, op );
+
                goto return_results;
        }
 
+       bdb2i_stop_timing( be->bd_info, time1, "ADD-DN2ID", conn, op );
+
+       bdb2i_start_timing( be->bd_info, &time1 );
+
        /* id2entry index */
        if ( bdb2i_id2entry_add( be, e ) != 0 ) {
                Debug( LDAP_DEBUG_TRACE, "bdb2i_id2entry_add failed\n", 0,
@@ -176,9 +201,13 @@ bdb2i_back_add_internal(
                (void) bdb2i_dn2id_delete( be, e->e_ndn );
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
 
+               bdb2i_stop_timing( be->bd_info, time1, "ADD-ID2ENTRY", conn, op );
+
                goto return_results;
        }
 
+       bdb2i_stop_timing( be->bd_info, time1, "ADD-ID2ENTRY", conn, op );
+
        send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
        rc = 0;
 
@@ -186,7 +215,6 @@ return_results:;
        if (p != NULL) {
                /* free parent and writer lock */
                bdb2i_cache_return_entry_w( &li->li_cache, p ); 
-
        }
 
        /* free entry and writer lock */
@@ -206,7 +234,7 @@ bdb2_back_add(
 {
        DB_LOCK         lock;
        struct ldbminfo *li  = (struct ldbminfo *) be->be_private;
-       struct timeval  time1;
+       struct timeval  time1, time2;
        int             ret;
 
        bdb2i_start_timing( be->bd_info, &time1 );
@@ -218,6 +246,8 @@ bdb2_back_add(
 
        }
 
+       bdb2i_start_timing( be->bd_info, &time2 );
+
        /*  check, if a new default attribute index will be created,
                in which case we have to open the index file BEFORE TP  */
        switch ( slapMode ) {
@@ -229,7 +259,8 @@ bdb2_back_add(
        }
 
        ret = bdb2i_back_add_internal( be, conn, op, e );
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       bdb2i_stop_timing( be->bd_info, time2, "ADD-INTERN", conn, op );
+       (void) bdb2i_leave_backend_w( get_dbenv( be ), lock );
        bdb2i_stop_timing( be->bd_info, time1, "ADD", conn, op );
 
        return( ret );
index a99efa7bca1cc754f009987c8bd6d1b32bf180da..f7d7e589055370502c4165c4023503ff009675b7 100644 (file)
@@ -79,6 +79,7 @@ struct cache {
        Avlnode         *c_idtree;
        Entry           *c_lruhead;     /* lru - add accessed entries here */
        Entry           *c_lrutail;     /* lru - rem lru entries from here */
+       ldap_pvt_thread_mutex_t c_mutex;
 };
 
 #define CACHE_READ_LOCK                1
index 8f0ae3c4a5992a0fffa3a1e5763488f5fe247ade..5110515455e5b41890cae272066b2e29745d3169 100644 (file)
@@ -242,7 +242,7 @@ bdb2_back_bind(
 
        ret = bdb2i_back_bind_internal( be, conn, op, dn, method, cred, edn );
 
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       (void) bdb2i_leave_backend_r( get_dbenv( be ), lock );
 
        bdb2i_stop_timing( be->bd_info, time1, "BIND", conn, op );
 
index 3374abfa571120c80f2264fe4a533c897a067b36..f63d3297adeba44ce36aefb7236002940f5cffe4 100644 (file)
@@ -71,6 +71,9 @@ cache_entry_private_destroy( Entry*e )
 void
 bdb2i_cache_return_entry_rw( struct cache *cache, Entry *e, int rw )
 {
+       /* set cache mutex */
+       ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
 #ifdef LDAP_DEBUG
        assert( e->e_private );
 #endif
@@ -104,6 +107,9 @@ bdb2i_cache_return_entry_rw( struct cache *cache, Entry *e, int rw )
                        "====> bdb2i_cache_return_entry_%s( %ld ): returned (%d)\n",
                        rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt);
        }
+
+       /* free cache mutex */
+       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
 }
 
 #define LRU_DELETE( cache, e ) { \
@@ -147,6 +153,9 @@ bdb2i_cache_add_entry_rw(
        int     i;
        Entry   *ee;
 
+       /* set cache mutex */
+       ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
 #ifdef LDAP_DEBUG
        assert( e->e_private == NULL );
 #endif
@@ -167,6 +176,8 @@ bdb2i_cache_add_entry_rw(
 
                cache_entry_private_destroy(e);
 
+               /* free cache mutex */
+               ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
                return( 1 );
        }
 
@@ -188,6 +199,8 @@ bdb2i_cache_add_entry_rw(
 
                cache_entry_private_destroy(e);
 
+               /* free cache mutex */
+               ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
                return( -1 );
        }
 
@@ -233,6 +246,8 @@ bdb2i_cache_add_entry_rw(
                }
        }
 
+       /* free cache mutex */
+       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
        return( 0 );
 }
 
@@ -251,6 +266,9 @@ bdb2i_cache_update_entry(
        int     i;
        Entry   *ee;
 
+       /* set cache mutex */
+       ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
 #ifdef LDAP_DEBUG
        assert( e->e_private );
 #endif
@@ -262,6 +280,8 @@ bdb2i_cache_update_entry(
                "====> bdb2i_cache_add_entry( %ld ): \"%s\": already in dn cache\n",
                    e->e_id, e->e_dn, 0 );
 
+               /* free cache mutex */
+               ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
                return( 1 );
        }
 
@@ -281,6 +301,8 @@ bdb2i_cache_update_entry(
                            0, 0, 0 );
                }
 
+               /* free cache mutex */
+               ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
                return( -1 );
        }
 
@@ -325,11 +347,13 @@ bdb2i_cache_update_entry(
                }
        }
 
+       /* free cache mutex */
+       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
        return( 0 );
 }
 
 /*
- * cache_find_entry_dn2id - find an entry in the cache, given dn
+ * bdb2i_cache_find_entry_dn2id - find an entry in the cache, given dn
  */
 
 ID
@@ -343,6 +367,9 @@ bdb2i_cache_find_entry_dn2id(
        Entry           e, *ep;
        ID                      id;
 
+       /* set cache mutex */
+       ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
        e.e_dn = dn;
        e.e_ndn = dn_normalize_case( ch_strdup( dn ) );
 
@@ -371,6 +398,8 @@ bdb2i_cache_find_entry_dn2id(
                        "====> bdb2i_cache_find_entry_dn2id(\"%s\"): %ld (not ready) %d\n",
                                dn, ep->e_id, LEI(ep)->lei_state);
 
+                       /* free cache mutex */
+                       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
                        return( NOID );
                }
 
@@ -385,11 +414,17 @@ bdb2i_cache_find_entry_dn2id(
                /* save id */
                id = ep->e_id;
 
+               /* free cache mutex */
+               ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
                return( id );
        }
 
        free(e.e_ndn);
 
+       /* free cache mutex */
+       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
        return( NOID );
 }
 
@@ -410,6 +445,9 @@ bdb2i_cache_find_entry_id(
        e.e_id = id;
 
 try_again:
+       /* set cache mutex */
+       ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
        if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
                entry_id_cmp )) != NULL )
        {
@@ -428,6 +466,8 @@ try_again:
                                "====> bdb2i_cache_find_entry_id( %ld ): %ld (not ready) %d\n",
                                id, ep->e_id, LEI(ep)->lei_state);
 
+                       /* free cache mutex */
+                       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
                        return( NULL );
                }
 
@@ -441,9 +481,15 @@ try_again:
                 
                LEI(ep)->lei_refcnt++;
 
+               /* free cache mutex */
+               ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
                return( ep );
        }
 
+       /* free cache mutex */
+       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
        return( NULL );
 }
 
@@ -466,6 +512,9 @@ bdb2i_cache_delete_entry(
 {
        int     rc;
 
+       /* set cache mutex */
+       ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
 #ifdef LDAP_DEBUG
        assert( e->e_private );
 #endif
@@ -475,6 +524,8 @@ bdb2i_cache_delete_entry(
 
        rc = cache_delete_entry_internal( cache, e );
 
+       /* free cache mutex */
+       ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
        return( rc );
 }
 
index 00f37f17179bbc39247772e662ce565b01b27a2b..6ea93d5203cb25f5bbfbab9711c478d35c999963 100644 (file)
@@ -86,7 +86,7 @@ bdb2_back_compare(
        }
 
        ret = bdb2i_back_compare_internal( be, conn, op, dn, ava );
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       (void) bdb2i_leave_backend_r( get_dbenv( be ), lock );
        bdb2i_stop_timing( be->bd_info, time1, "CMP", conn, op );
 
        return( ret );
index 1b13f48dbb66a2ed2ce7a6434b757bdf20d3e0ee..405e9e924dd779b52314464758b1e2c0e45f73c8 100644 (file)
@@ -139,6 +139,7 @@ bdb2i_cache_store(
 )
 {
        int     rc;
+       struct timeval  time1;
 
 #ifdef LDBM_DEBUG
        Statslog( LDAP_DEBUG_STATS,
@@ -158,8 +159,23 @@ bdb2i_cache_store(
                flags, 0, 0, 0, 0 );
 #endif /* LDBM_DEBUG */
 
+       if ( slapMode == SLAP_TIMEDSERVER_MODE )
+               bdb2i_uncond_start_timing( &time1 );
+
        rc = ldbm_store( db->dbc_db, key, data, flags );
 
+       if ( slapMode == SLAP_TIMEDSERVER_MODE ) {
+               char buf[BUFSIZ];
+               char buf2[BUFSIZ];
+
+               *buf2 = '\0';
+               if ( !( strcasecmp( db->dbc_name, "dn.bdb2" )))
+                       sprintf( buf2, " [%s]", key.dptr );
+               sprintf( buf, "ADD-BDB2( %s%s )", db->dbc_name, buf2 );
+               bdb2i_uncond_stop_timing( time1, buf,
+                                       NULL, NULL, LDAP_DEBUG_TRACE );
+       }
+
        return( rc );
 }
 
index 57e910e15f048b189cc3792af475a4ee7afc54c8..2affa8db850affcb8cc3f8558c0475754b2a7352 100644 (file)
@@ -164,7 +164,7 @@ bdb2_back_delete(
        }
 
        ret = bdb2i_back_delete_internal( be, conn, op, dn );
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       (void) bdb2i_leave_backend_w( get_dbenv( be ), lock );
        bdb2i_stop_timing( be->bd_info, time1, "DEL", conn, op );
 
        return( ret );
index aa89afa078e3acab161832d81dcbba999fde0c6f..60a829e7d3c0178cc1cdf934f14d85af55ed4008 100644 (file)
@@ -150,7 +150,7 @@ bdb2_back_group(
        ret = bdb2i_back_group_internal( be, target, gr_ndn, op_ndn,
                                        objectclassValue, groupattrName );
 
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       (void) bdb2i_leave_backend_r( get_dbenv( be ), lock );
        bdb2i_stop_timing( be->bd_info, time1, "GRP", NULL, NULL );
 
        return( ret );
index 1892b7e2865a2caf2b1aac0a0c4515d1612ab8fb..e64eb998ea2965af29e4022a1c8144c4efa91c2d 100644 (file)
@@ -172,6 +172,9 @@ bdb2i_back_db_init_internal(
            1 );
        free( argv[ 1 ] );
 
+       /*  initialize the cache mutex */
+       ldap_pvt_thread_mutex_init( &li->li_cache.c_mutex );
+
        /*  initialize the TP file head  */
        if ( bdb2i_txn_head_init( &li->li_txn_head ) != 0 )
                return 1;
index d0c0ebe86a7881dec8bf6c25bcbffc37c66a7414..3178f66985e83c309c279bbc419891674b5b7d1c 100644 (file)
@@ -149,7 +149,7 @@ bdb2_back_modify(
        }
 
         ret = bdb2i_back_modify_internal( be, conn, op, dn, modlist );
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       (void) bdb2i_leave_backend_w( get_dbenv( be ), lock );
        bdb2i_stop_timing( be->bd_info, time1, "MOD", conn, op );
 
        return( ret );
index 147bc09ca5f5d77abdb332f15bf5da352f4edf6d..0dd5a01b6ed13abb5adb410d9730c3d28f791c62 100644 (file)
@@ -209,7 +209,7 @@ bdb2_back_modrdn(
        ret = bdb2i_back_modrdn_internal( be, conn, op, dn,
                                        newrdn, deleteoldrdn );
 
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       (void) bdb2i_leave_backend_w( get_dbenv( be ), lock );
        bdb2i_stop_timing( be->bd_info, time1, "MODRDN", conn, op );
 
        return( ret );
index 4ee72b99779435c270f1192839505933891be0c1..96f0576d471da674287f5556da24dce35671e7af 100644 (file)
@@ -13,8 +13,8 @@
 #define  PORTER_OBJ   "bdb2_backend"
 
 
-static int
-bdb2i_enter_backend( DB_ENV *dbEnv, DB_LOCK *lock, int writer )
+int
+bdb2i_enter_backend_rw( DB_ENV *dbEnv, DB_LOCK *lock, int writer )
 {
        u_int32_t      locker;
        db_lockmode_t  lock_type;
@@ -76,21 +76,7 @@ bdb2i_enter_backend( DB_ENV *dbEnv, DB_LOCK *lock, int writer )
 
 
 int
-bdb2i_enter_backend_r( DB_ENV *dbEnv, DB_LOCK *lock )
-{
-       return( bdb2i_enter_backend( dbEnv, lock, 0 ));
-}
-
-
-int
-bdb2i_enter_backend_w( DB_ENV *dbEnv, DB_LOCK *lock )
-{
-       return( bdb2i_enter_backend( dbEnv, lock, 1 ));
-}
-
-
-int
-bdb2i_leave_backend( DB_ENV *dbEnv, DB_LOCK lock )
+bdb2i_leave_backend_rw( DB_ENV *dbEnv, DB_LOCK lock, int writer )
 {
        int   ret = 0;
 
@@ -103,26 +89,26 @@ bdb2i_leave_backend( DB_ENV *dbEnv, DB_LOCK lock )
 
                                case 0:
                                        Debug( LDAP_DEBUG_TRACE,
-                                               "bdb2i_leave_backend() -- lock released\n",
-                                               0, 0, 0 );
+                                               "bdb2i_leave_backend() -- %s lock released\n",
+                                               writer ? "write" : "read", 0, 0 );
                                        break;
 
                                case DB_LOCK_NOTHELD:
                                        Debug( LDAP_DEBUG_ANY,
-                                               "bdb2i_leave_backend() -- lock NOT held\n",
-                                               0, 0, 0 );
+                                               "bdb2i_leave_backend() -- %s lock NOT held\n",
+                                               writer ? "write" : "read", 0, 0 );
                                        break;
 
                                case DB_LOCK_DEADLOCK:
                                        Debug( LDAP_DEBUG_ANY,
-                                               "bdb2i_leave_backend() -- lock returned DEADLOCK\n",
-                                               0, 0, 0 );
+                                               "bdb2i_leave_backend() -- %s lock returned DEADLOCK\n",
+                                               writer ? "write" : "read", 0, 0 );
                                        break;
 
                                default:
                                        Debug( LDAP_DEBUG_ANY,
-                                               "bdb2i_leave_backend() -- lock returned ERROR: %s\n",
-                                               strerror( errno ), 0, 0 );
+                                               "bdb2i_leave_backend() -- %s lock returned ERROR: %s\n",
+                                               writer ? "write" : "read", strerror( errno ), 0 );
                                        ret = errno;
                                        break;
                        
index d964894389d539c2a7c37630b579ea21284b2f7e..5020e531c09381d8f087a46e926bb8ae93b3a7fd 100644 (file)
@@ -153,19 +153,22 @@ int bdb2i_back_db_shutdown LDAP_P(( BackendDB *be ));
  *  timing.c
  */
 
-char *bdb2i_elapsed LDAP_P(( struct timeval firsttime,
- struct timeval secondtime ));
-void bdb2i_start_timing LDAP_P(( BackendInfo *bi, struct timeval *time1 ));
-void bdb2i_stop_timing LDAP_P(( BackendInfo *bi, struct timeval time1,
-  char *func, Connection *conn, Operation *op ));
+void bdb2i_uncond_start_timing LDAP_P(( struct timeval *time1 ));
+#define bdb2i_start_timing(bi,time1)  if ( with_timing( bi )) bdb2i_uncond_start_timing( (time1) )
+void bdb2i_uncond_stop_timing LDAP_P(( struct timeval time1,
+  char *func, Connection *conn, Operation *op, int level ));
+#define bdb2i_stop_timing(bi,time1,func,conn,op)  if ( with_timing( bi )) bdb2i_uncond_stop_timing( (time1), (func), (conn), (op), LDAP_DEBUG_ANY )
 
 /*
  * porter.c
  */
 
-int bdb2i_enter_backend_r  LDAP_P(( DB_ENV *dbEnv, DB_LOCK *lock ));
-int bdb2i_enter_backend_w  LDAP_P(( DB_ENV *dbEnv, DB_LOCK *lock ));
-int bdb2i_leave_backend    LDAP_P(( DB_ENV *dbEnv, DB_LOCK lock ));
+int bdb2i_enter_backend_rw  LDAP_P(( DB_ENV *dbEnv, DB_LOCK *lock, int writer ));
+#define bdb2i_enter_backend_r(dbEnv,lock)  bdb2i_enter_backend_rw( (dbEnv), (lock), 0 )
+#define bdb2i_enter_backend_w(dbEnv,lock)  bdb2i_enter_backend_rw( (dbEnv), (lock), 1 )
+int bdb2i_leave_backend_rw LDAP_P(( DB_ENV *dbEnv, DB_LOCK lock, int writer ));
+#define bdb2i_leave_backend_r(dbEnv,lock)  bdb2i_leave_backend_rw( (dbEnv), (lock), 0 )
+#define bdb2i_leave_backend_w(dbEnv,lock)  bdb2i_leave_backend_rw( (dbEnv), (lock), 1 )
 
 /*
  *  txn.c
index 60b9d417e6ab96bf1b6264db9529ef21fe755205..04e68498d44fa3da2745d67d47617bb0aef34252 100644 (file)
@@ -347,7 +347,7 @@ bdb2_back_search(
        ret = bdb2i_back_search_internal( be, conn, op, base, scope, deref,
                                        slimit, tlimit, filter, filterstr, attrs, attrsonly );
 
-       (void) bdb2i_leave_backend( get_dbenv( be ), lock );
+       (void) bdb2i_leave_backend_r( get_dbenv( be ), lock );
        bdb2i_stop_timing( be->bd_info, time1, "SRCH", conn, op );
 
        return( ret );
index 024d3e238c837489213db9afef93233dd8fdcc1f..6f6d73c814ec213fea64ac179588b15c0e466c84 100644 (file)
@@ -43,7 +43,7 @@ bdb2i_back_startup_internal(
                (void) getcwd( cwd, MAXPATHLEN );
                sprintf( cwd, "%s%s%s", cwd, DEFAULT_DIRSEP, lty->lty_dbhome );
                free( lty->lty_dbhome );
-               lty->lty_dbhome = strdup( cwd );
+               lty->lty_dbhome = ch_strdup( cwd );
 
        }
        home = lty->lty_dbhome;
@@ -158,7 +158,7 @@ bdb2i_back_db_startup_internal(
                (void) getcwd( cwd, MAXPATHLEN );
                sprintf( cwd, "%s%s%s", cwd, DEFAULT_DIRSEP, li->li_directory );
                free( li->li_directory );
-               li->li_directory = strdup( cwd );
+               li->li_directory = ch_strdup( cwd );
 
        }
 
index fd08a4f63b6a060f930e901e2fa5a0a127474bc5..d1e757aaa04015c65e2e1113e70e86a68d6fb0a5 100644 (file)
@@ -12,7 +12,7 @@
 #include "back-bdb2.h"
 
 
-char *
+static char *
 bdb2i_elapsed( struct timeval firsttime,  struct timeval secondtime )
 {
     long int elapsedmicrosec, elapsedsec;
@@ -26,47 +26,44 @@ bdb2i_elapsed( struct timeval firsttime,  struct timeval secondtime )
     }
 
     sprintf( elapsed_string, "%ld.%.6ld", elapsedsec, elapsedmicrosec );
-    return( strdup( elapsed_string ));
+    return( ch_strdup( elapsed_string ));
 }
 
 
 void
-bdb2i_start_timing(
-       BackendInfo     *bi,
+bdb2i_uncond_start_timing(
        struct timeval  *time1
 )
 {
-       if ( with_timing( bi )) gettimeofday( time1, NULL );
+       gettimeofday( time1, NULL );
 }
 
 
 void
-bdb2i_stop_timing(
-       BackendInfo     *bi,
+bdb2i_uncond_stop_timing(
        struct timeval  time1,
        char            *func,
        Connection      *conn,
-       Operation       *op
+       Operation       *op,
+       int             level
 )
 {
-       if ( with_timing( bi )) {
-               struct timeval  time2;
-               char            *elapsed_time;
-               char            buf[BUFSIZ];
+       struct timeval  time2;
+       char            *elapsed_time;
+       char            buf[BUFSIZ];
 
-               *buf = '\0';
+       *buf = '\0';
 
-               gettimeofday( &time2, NULL);
-               elapsed_time = bdb2i_elapsed( time1, time2 );
+       gettimeofday( &time2, NULL);
+       elapsed_time = bdb2i_elapsed( time1, time2 );
 
-               if ( conn != NULL ) sprintf( buf, "conn=%d ", conn->c_connid );
-               if ( op != NULL )   sprintf( buf, "%sop=%d ", buf, op->o_opid );
+       if ( conn != NULL ) sprintf( buf, "conn=%d ", conn->c_connid );
+       if ( op != NULL )   sprintf( buf, "%sop=%d ", buf, op->o_opid );
 
-               Debug( LDAP_DEBUG_ANY, "%s%s elapsed=%s\n", buf, func, elapsed_time );
+       Debug( level, "%s%s elapsed=%s\n", buf, func, elapsed_time );
 
-               free( elapsed_time );
+       free( elapsed_time );
 
-       }
 }
 
 
index 9dc238c4f7a91e77b9bb168d06434b36ffa527ee..817678b5df1cd0cbf5c76a73859abbec935d2cbd 100644 (file)
@@ -26,7 +26,7 @@ bdb2i_txn_head_init( BDB2_TXN_HEAD *head )
                }
 
                sprintf( fileName, "%s%s", bdb2i_fixed_filenames[dbFile], BDB2_SUFFIX );
-               (*fileNodeH)->dbc_name = strdup( fileName );
+               (*fileNodeH)->dbc_name = ch_strdup( fileName );
 
                fileNodeH = &(*fileNodeH)->next;
 
@@ -119,7 +119,7 @@ bdb2i_txn_attr_config(
                                }
                        }
 
-                       p->dbc_name = strdup( fileName );
+                       p->dbc_name = ch_strdup( fileName );
 
                        /*  if requested for, we have to open the DB file  */
                        /*  BUT NOT "objectclass", 'cause that's a default index !  */