Threads Debugging Library Functions td_ta_enable_stats(3C_DB)
NAME
td_ta_enable_stats, td_ta_reset_stats, td_ta_get_stats -
collect target process statistics for libc_db
SYNOPSIS
cc [ flag... ] file... -lc_db [ library... ]
#include
#include
td_err_e td_ta_enable_stats(const td_thragent_t *ta_p, int on_off);
td_err_e_stats td_ta_reset(const td_thragent_t *ta_p);
td_err_e td_ta_get_stats(const td_thragent_t *ta_p, td_ta_stats_t *tstats);
DESCRIPTION
The controlling process can request the collection of cer-
tain statistics about a target process. Statistics gather-
ing is disabled by default. Each target process has atd_ta_stats_t structure that contains current values when
statistic gathering is enabled.The td_ta_enable_stats() function turns statistics gathering
on or off for the process identified by ta_p, depending on
whether or not on_off is non-zero. When statistics gathering
is turned on, all statistics are implicitly reset as thoughtd_ta_reset_stats() had been called. Statistics are not
reset when statistics gathering is turned off. Except fornthreads and r_concurrency, the values do not change
further, but they remain available for inspection by way oftd_ta_get_stats().
The td_ta_reset_stats() function resets all counters in the
td_ta_stats_t structure to zero for the target process.
The td_ta_get_stats() function returns the structure for the
process in tstats.The td_ta_stats_t structure is defined in
contains the following members: typedef struct { int nthreads; /* total number of threads in use */and int r_concurrency; /* requested concurrency level */
int nrunnable_num; /* numerator of avg runnable threads */
SunOS 5.11 Last change: 20 Oct 1998 1
Threads Debugging Library Functions td_ta_enable_stats(3C_DB)
int nrunnable_den; /* denominator of avg runnable threads */
int a_concurrency_num; /* numerator, avg achieved concurrency */
int a_concurrency_den; /* denominator, avg achieved concurrency */
int nlwps_num; /* numerator, avg number of LWPs in use */
int nlwps_den; /* denominator, avg number of LWPs in use */
int nidle_num; /* numerator, avg number of idling LWPs */
int nidle_den; /* denominator, avg number of idling LWPs */
} td_ta_stats_t;
The nthreads member is the number of threads that arecurrently part of the target process. The r_concurrency
member is the current requested concurrency level, such aswould be returned by thr_setconcurrency(3C). The remaining
members are averages over time, each expressed as a frac-
tion with an integral numerator and denominator. Thenrunnable_num and nrunnable_den members represent the aver-
age number of runnable threads. The a_concurrency_num and
a_concurrency_den members represent the average achieved
concurrency, the number of actually running threads. Thea_concurrency_num and a_concurrency_den members are less
than or equal to nrunnable_num and nrunnable_den, respec-
tively. The nlwps_num and nlwps_den members represent the
average number of lightweight processes (LWPs) participat-
ing in this process. They must be greater than or equal toa_concurrency_num and a_concurrency_den, respectively, since
every running thread is assigned to an LWP, but there can at times be additional idling LWPs with no thread assignedto them. The nidle_num and nidle_den members represent the
average number of idle LWPs.RETURN VALUES
TD_OK The call completed successfully.
TD_BADTA An invalid internal process handle was passed
in.TD_DBERR A call to one of the imported interface rou-
tines failed.TD_ERR Something else went wrong.
ATTRIBUTES
See attributes(5) for description of the following attri-
butes:SunOS 5.11 Last change: 20 Oct 1998 2
Threads Debugging Library Functions td_ta_enable_stats(3C_DB)
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| MT Level | Safe ||_____________________________|_____________________________|
SEE ALSO
libc_db(3LIB), thr_getconcurrency(3C), attributes(5)
SunOS 5.11 Last change: 20 Oct 1998 3