2 .\" Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH TD_TA_ENABLE_STATS 3C_DB "Oct 20, 1998"
8 td_ta_enable_stats, td_ta_reset_stats, td_ta_get_stats \- collect target
9 process statistics for libc_db
13 cc [ \fIflag\fR... ] \fIfile\fR... -lc_db [ \fIlibrary\fR... ]
14 #include <proc_service.h>
15 #include <thread_db.h>
17 \fBtd_err_e\fR \fBtd_ta_enable_stats\fR(\fBconst td_thragent_t *\fR\fIta_p\fR, \fBint\fR\fI on_off\fR);
22 \fBtd_err_e_stats\fR \fBtd_ta_reset\fR(\fBconst td_thragent_t *\fR\fIta_p\fR);
27 \fBtd_err_e\fR \fBtd_ta_get_stats\fR(\fBconst td_thragent_t *\fR\fIta_p\fR, \fBtd_ta_stats_t *\fR\fItstats\fR);
33 The controlling process can request the collection of certain statistics about
34 a target process. Statistics gathering is disabled by default. Each target
35 process has a \fBtd_ta_stats_t\fR structure that contains current values when
36 statistic gathering is enabled.
39 The \fBtd_ta_enable_stats()\fR function turns statistics gathering on or off
40 for the process identified by \fIta_p\fR, depending on whether or not
41 \fIon_off\fR is non-zero. When statistics gathering is turned on, all
42 statistics are implicitly reset as though \fBtd_ta_reset_stats()\fR had been
43 called. Statistics are not reset when statistics gathering is turned off.
44 Except for \fBnthreads\fR \fBand\fR \fBr_concurrency\fR, the values do not
45 change further, but they remain available for inspection by way of
46 \fBtd_ta_get_stats()\fR.
49 The \fBtd_ta_reset_stats()\fR function resets all counters in the
50 \fBtd_ta_stats_t\fR structure to zero for the target process.
53 The \fBtd_ta_get_stats()\fR function returns the structure for the process in
57 The \fBtd_ta_stats_t\fR structure is defined in <\fBthread_db.h\fR> and
58 contains the following members:
63 int nthreads; /* total number of threads in use */
64 int r_concurrency; /* requested concurrency level */
65 int nrunnable_num; /* numerator of avg runnable threads */
66 int nrunnable_den; /* denominator of avg runnable threads */
67 int a_concurrency_num; /* numerator, avg achieved concurrency */
68 int a_concurrency_den; /* denominator, avg achieved concurrency */
69 int nlwps_num; /* numerator, avg number of LWPs in use */
70 int nlwps_den; /* denominator, avg number of LWPs in use */
71 int nidle_num; /* numerator, avg number of idling LWPs */
72 int nidle_den; /* denominator, avg number of idling LWPs */
73 } td_ta_stats_t;\fI\fR
79 The \fBnthreads\fR member is the number of threads that are currently part of
80 the target process. The \fBr_concurrency\fR member is the current requested
81 concurrency level, such as would be returned by \fBthr_setconcurrency\fR(3C).
82 The remaining members are averages over time, each expressed as a fraction
83 with an integral numerator and denominator. The \fBnrunnable_num\fR and
84 \fBnrunnable_den\fR members represent the average number of runnable threads.
85 The \fBa_concurrency_num\fR and \fBa_concurrency_den\fR members represent the
86 average achieved concurrency, the number of actually running threads. The
87 \fBa_concurrency_num\fR and \fBa_concurrency_den\fR members are less than or
88 equal to \fBnrunnable_num\fR and \fBnrunnable_den\fR, respectively. The
89 \fBnlwps_num\fR and \fBnlwps_den\fR members represent the average number of
90 lightweight processes (\fBLWP\fRs) participating in this process. They must be
91 greater than or equal to \fBa_concurrency_num\fR and \fBa_concurrency_den\fR,
92 respectively, since every running thread is assigned to an \fBLWP\fR, but
93 there can at times be additional idling \fBLWP\fRs with no thread assigned to
94 them. The \fBnidle_num\fR and \fBnidle_den\fR members represent the average
95 number of idle \fBLWP\fRs.
103 The call completed successfully.
109 \fB\fBTD_BADTA\fR \fR
112 An invalid internal process handle was passed in.
118 \fB\fBTD_DBERR\fR \fR
121 A call to one of the imported interface routines failed.
130 Something else went wrong.
136 See \fBattributes\fR(5) for description of the following attributes:
144 ATTRIBUTE TYPE ATTRIBUTE VALUE
152 \fBlibc_db\fR(3LIB), \fBthr_getconcurrency\fR(3C), \fBattributes\fR(5)