Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/prstat/prstat.h
+++ new/usr/src/cmd/prstat/prstat.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2013 Gary Mills
24 24 *
25 25 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 *
28 28 * Portions Copyright 2009 Chad Mynhier
29 + * Copyright 2018 Joyent, Inc. All rights reserved.
29 30 */
30 31
31 32 #ifndef _PRSTAT_H
32 33 #define _PRSTAT_H
33 34
34 35 #include <sys/sysmacros.h>
35 36 #include <sys/time.h>
36 37 #include <sys/types.h>
37 38 #include <procfs.h>
38 39
39 40 #ifdef __cplusplus
40 41 extern "C" {
41 42 #endif
42 43
43 44 /*
44 45 * FRC2PCT macro is used to convert 16-bit binary fractions in the range
45 46 * 0.0 to 1.0 with binary point to the right of the high order bit
46 47 * (i.e. 1.0 == 0x8000) to percentage value.
47 48 */
48 49
49 50 #define FRC2PCT(pp) (((float)(pp))/0x8000*100)
50 51
51 52 #define TIME2NSEC(__t)\
52 53 (hrtime_t)(((hrtime_t)__t.tv_sec * (hrtime_t)NANOSEC) + (hrtime_t)__t.tv_nsec)
53 54 #define TIME2SEC(__t)\
54 55 (hrtime_t)(__t.tv_sec)
55 56
56 57 /*
57 58 * List of available output modes
58 59 */
59 60 #define OPT_PSINFO 0x0001 /* read process's data from "psinfo" */
60 61 #define OPT_LWPS 0x0002 /* report about all lwps */
61 62 #define OPT_USERS 0x0004 /* report about most active users */
62 63 #define OPT_UNUSED 0x0008 /* reserved for future use */
63 64 #define OPT_REALTIME 0x0010 /* real-time scheduling class flag */
64 65 #define OPT_MSACCT 0x0020 /* microstate accounting flag */
65 66 #define OPT_TERMCAP 0x0040 /* use termcap data to move cursor */
66 67 #define OPT_SPLIT 0x0080 /* split-screen mode flag */
67 68 #define OPT_TTY 0x0100 /* report results to tty or file */
68 69 #define OPT_FULLSCREEN 0x0200 /* full-screen mode flag */
69 70 #define OPT_USEHOME 0x0400 /* use 'home' to move cursor up */
70 71 #define OPT_TASKS 0x0800 /* report about system tasks */
71 72 #define OPT_PROJECTS 0x1000 /* report about system projects */
72 73 #define OPT_ZONES 0x2000 /* report about zones */
73 74 #define OPT_PSETS 0x4000 /* report for specified psets */
74 75 #define OPT_LGRP 0x8000 /* report home lgroups */
75 76 #define OPT_UDATE 0x20000 /* print unix timestamp */
76 77 #define OPT_DDATE 0x40000 /* print timestamp in date(1) format */
77 78 #define OPT_NORESOLVE 0x80000 /* no nsswitch lookups */
78 79 #define OPT_TRUNC 0x100000 /* truncate long names */
79 80
80 81 /*
81 82 * Flags to keep track of process or lwp status
82 83 */
83 84 #define LWP_ALIVE 0x0008 /* this pid/lwp still exists */
84 85 #define LWP_REPRESENT 0x0010 /* this LWP represents the process */
85 86
86 87 /*
87 88 * Possible list types
88 89 */
89 90 #define LT_LWPS 0x0001
90 91 #define LT_USERS 0x0002
91 92 #define LT_TASKS 0x0004
92 93 #define LT_PROJECTS 0x0008
93 94 #define LT_ZONES 0x0010
94 95 #define LT_LGRPS 0x0020
95 96
96 97 /*
97 98 * Linked list of per-process or per-lwp statistics
98 99 */
99 100 typedef struct lwp_info {
100 101 psinfo_t li_info; /* data read from psinfo file */
101 102 prusage_t li_usage; /* data read from usage file */
102 103 ulong_t li_key; /* value of the key for this lwp */
103 104 int li_flags; /* process/lwp flags */
104 105 float li_usr; /* user level CPU time */
105 106 float li_sys; /* system call CPU time */
↓ open down ↓ |
67 lines elided |
↑ open up ↑ |
106 107 float li_trp; /* other system trap CPU time */
107 108 float li_tfl; /* text page fault sleep time */
108 109 float li_dfl; /* data page fault sleep time */
109 110 float li_lck; /* user lock wait sleep time */
110 111 float li_slp; /* all other sleep time */
111 112 float li_lat; /* wait-cpu (latency) time */
112 113 ulong_t li_vcx; /* voluntary context switches */
113 114 ulong_t li_icx; /* involuntary context switches */
114 115 ulong_t li_scl; /* system calls */
115 116 ulong_t li_sig; /* received signals */
117 + char li_lwpname[THREAD_NAME_MAX];
116 118 struct lwp_info *li_next; /* pointer to next lwp */
117 119 struct lwp_info *li_prev; /* pointer to previous lwp */
118 120 } lwp_info_t;
119 121
120 122 /*
121 123 * Linked list of collective per-uid, per-taskid, per-projid or per-lgroup
122 124 * statistics
123 125 */
124 126 typedef struct id_info {
125 127 uid_t id_uid; /* user id */
126 128 taskid_t id_taskid; /* task id */
127 129 projid_t id_projid; /* project id */
128 130 zoneid_t id_zoneid; /* zone id */
129 131 int id_lgroup; /* lgroup id */
130 132 uint_t id_nproc; /* number of processes */
131 133 boolean_t id_sizematch; /* size/rssize from getvmusage() */
132 134 size_t id_size; /* memory usage */
133 135 size_t id_rssize; /* resident set size */
134 136 ulong_t id_time; /* cpu time (in secs) */
135 137 float id_pctcpu; /* percentage of cpu usage */
136 138 float id_pctmem; /* percentage of memory usage */
137 139 ulong_t id_key; /* sort key value */
138 140 struct id_info *id_next; /* pointer to next entry */
139 141 struct id_info *id_prev; /* pointer to previous entry */
140 142 } id_info_t;
141 143
142 144 typedef ulong_t (*keyfunc_t)(void *);
143 145
144 146 /*
145 147 * Per-list structure
146 148 */
147 149 typedef struct list {
148 150 int l_type; /* list type */
149 151 int l_count; /* number of entries in the list */
150 152 void *l_head; /* pointer to the head of the list */
151 153 void *l_tail; /* pointer to the tail of the list */
152 154
153 155 int l_size; /* number of allocated pointers */
154 156 int l_used; /* number of used pointers */
155 157 int l_sortorder; /* sorting order for the list */
156 158 keyfunc_t l_func; /* pointer to key function */
157 159 void **l_ptrs; /* pointer to an array of pointers */
158 160 } list_t;
159 161
↓ open down ↓ |
34 lines elided |
↑ open up ↑ |
160 162 /*
161 163 * Command line options
162 164 */
163 165 typedef struct optdesc {
164 166 int o_interval; /* interval between updates */
165 167 int o_ntop; /* number of lines in top half */
166 168 int o_nbottom; /* number of lines in bottom half */
167 169 int o_count; /* number of iterations */
168 170 int o_outpmode; /* selected output mode */
169 171 int o_sortorder; /* +1 ascending, -1 descending */
172 + int o_cols; /* number of columns */
170 173 } optdesc_t;
171 174
175 +extern optdesc_t opts;
176 +
172 177 #ifdef __cplusplus
173 178 }
174 179 #endif
175 180
176 181 #endif /* _PRSTAT_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX