self-document thread monitoring

This commit is contained in:
Pierangelo Masarati 2007-01-06 16:19:15 +00:00
parent 45edf395eb
commit 0e835b0c32

View 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 );
}