]> git.sur5r.net Git - openldap/commitdiff
self-document thread monitoring
authorPierangelo Masarati <ando@openldap.org>
Sat, 6 Jan 2007 16:19:15 +0000 (16:19 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 6 Jan 2007 16:19:15 +0000 (16:19 +0000)
servers/slapd/back-monitor/thread.c

index 2c1b6e2d2bc16b5eba6c5c7aa06fab5f319eea6c..51da57fa37c08e66ff789e116d0799aeb19627f0 100644 (file)
@@ -40,26 +40,53 @@ typedef enum {
 
 static struct {
        struct berval                   rdn;
+       struct berval                   desc;
        struct berval                   nrdn;
        ldap_pvt_thread_pool_param_t    param;
        monitor_thread_t                mt;
 }              mt[] = {
-       { BER_BVC( "cn=Max" ),          BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_MAX,         MT_UNKNOWN },
-       { BER_BVC( "cn=Max Pending" ),  BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_MAX_PENDING, MT_UNKNOWN },
-       { BER_BVC( "cn=Open" ),         BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_OPEN,        MT_UNKNOWN },
-       { BER_BVC( "cn=Starting" ),     BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_STARTING,    MT_UNKNOWN },
-       { BER_BVC( "cn=Active" ),       BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_ACTIVE,      MT_UNKNOWN },
-       { BER_BVC( "cn=Pending" ),      BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_PENDING,     MT_UNKNOWN },
-       { BER_BVC( "cn=Backload" ),     BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_BACKLOAD,    MT_UNKNOWN },
+       { BER_BVC( "cn=Max" ),
+               BER_BVC("Maximum number of threads as configured"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_MAX,         MT_UNKNOWN },
+       { BER_BVC( "cn=Max Pending" ),
+               BER_BVC("Maximum number of pending threads"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_MAX_PENDING, MT_UNKNOWN },
+       { BER_BVC( "cn=Open" ),         
+               BER_BVC("Number of open threads"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_OPEN,        MT_UNKNOWN },
+       { BER_BVC( "cn=Starting" ),     
+               BER_BVC("Number of threads being started"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_STARTING,    MT_UNKNOWN },
+       { BER_BVC( "cn=Active" ),       
+               BER_BVC("Number of active threads"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_ACTIVE,      MT_UNKNOWN },
+       { BER_BVC( "cn=Pending" ),      
+               BER_BVC("Number of pending threads"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_PENDING,     MT_UNKNOWN },
+       { BER_BVC( "cn=Backload" ),     
+               BER_BVC("Number of active plus pending threads"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_BACKLOAD,    MT_UNKNOWN },
 #if 0  /* not meaningful right now */
-       { BER_BVC( "cn=Active Max" ),   BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_ACTIVE_MAX,  MT_UNKNOWN },
-       { BER_BVC( "cn=Pending Max" ),  BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_PENDING_MAX, MT_UNKNOWN },
-       { BER_BVC( "cn=Backload Max" ), BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_BACKLOAD_MAX,MT_UNKNOWN },
+       { BER_BVC( "cn=Active Max" ),
+               BER_BVNULL,
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_ACTIVE_MAX,  MT_UNKNOWN },
+       { BER_BVC( "cn=Pending Max" ),
+               BER_BVNULL,
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_PENDING_MAX, MT_UNKNOWN },
+       { BER_BVC( "cn=Backload Max" ),
+               BER_BVNULL,
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_BACKLOAD_MAX,MT_UNKNOWN },
 #endif
-       { BER_BVC( "cn=State" ),        BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_STATE,       MT_UNKNOWN },
+       { BER_BVC( "cn=State" ),
+               BER_BVC("Thread pool state"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_STATE,       MT_UNKNOWN },
 
-       { BER_BVC( "cn=Runqueue" ),     BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_UNKNOWN,     MT_RUNQUEUE },
-       { BER_BVC( "cn=Tasklist" ),     BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_UNKNOWN,     MT_TASKLIST },
+       { BER_BVC( "cn=Runqueue" ),
+               BER_BVC("Queue of running threads - besides those handling operations"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_UNKNOWN,     MT_RUNQUEUE },
+       { BER_BVC( "cn=Tasklist" ),
+               BER_BVC("List of standby threads - besides those handling operations"),
+               BER_BVNULL,     LDAP_PVT_THREAD_POOL_PARAM_UNKNOWN,     MT_TASKLIST },
 
        { BER_BVNULL }
 };
@@ -92,7 +119,7 @@ monitor_subsys_thread_init(
        if ( monitor_cache_get( mi, &ms->mss_ndn, &e_thread ) ) {
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_thread_init: unable to get entry \"%s\"\n",
-                       ms->mss_ndn.bv_val, 
+                       ms->mss_dn.bv_val, 
                        0, 0 );
                return( -1 );
        }
@@ -153,6 +180,12 @@ monitor_subsys_thread_init(
                if ( !BER_BVISNULL( &bv ) ) {
                        attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo, &bv, NULL );
                }
+
+               if ( !BER_BVISNULL( &mt[ i ].desc ) ) {
+                       attr_merge_normalize_one( e,
+                               slap_schema.si_ad_description,
+                               &mt[ i ].desc, NULL );
+               }
        
                mp = monitor_entrypriv_create();
                if ( mp == NULL ) {
@@ -168,7 +201,7 @@ monitor_subsys_thread_init(
                                "monitor_subsys_thread_init: "
                                "unable to add entry \"%s,%s\"\n",
                                mt[ i ].rdn.bv_val,
-                               ms->mss_ndn.bv_val, 0 );
+                               ms->mss_dn.bv_val, 0 );
                        return( -1 );
                }