Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2013 Gary Mills
  24  *
  25  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  *
  28  * Portions Copyright 2009 Chad Mynhier

  29  */
  30 
  31 #ifndef _PRSTAT_H
  32 #define _PRSTAT_H
  33 
  34 #include <sys/sysmacros.h>
  35 #include <sys/time.h>
  36 #include <sys/types.h>
  37 #include <procfs.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*
  44  * FRC2PCT macro is used to convert 16-bit binary fractions in the range
  45  * 0.0 to 1.0 with binary point to the right of the high order bit
  46  * (i.e. 1.0 == 0x8000) to percentage value.
  47  */
  48 


  96 /*
  97  * Linked list of per-process or per-lwp statistics
  98  */
  99 typedef struct lwp_info {
 100         psinfo_t        li_info;        /* data read from psinfo file */
 101         prusage_t       li_usage;       /* data read from usage file */
 102         ulong_t         li_key;         /* value of the key for this lwp */
 103         int             li_flags;       /* process/lwp flags */
 104         float           li_usr;         /* user level CPU time */
 105         float           li_sys;         /* system call CPU time */
 106         float           li_trp;         /* other system trap CPU time */
 107         float           li_tfl;         /* text page fault sleep time */
 108         float           li_dfl;         /* data page fault sleep time */
 109         float           li_lck;         /* user lock wait sleep time */
 110         float           li_slp;         /* all other sleep time */
 111         float           li_lat;         /* wait-cpu (latency) time */
 112         ulong_t         li_vcx;         /* voluntary context switches */
 113         ulong_t         li_icx;         /* involuntary context switches */
 114         ulong_t         li_scl;         /* system calls */
 115         ulong_t         li_sig;         /* received signals */

 116         struct lwp_info *li_next;       /* pointer to next lwp */
 117         struct lwp_info *li_prev;       /* pointer to previous lwp */
 118 } lwp_info_t;
 119 
 120 /*
 121  * Linked list of collective per-uid, per-taskid, per-projid or per-lgroup
 122  * statistics
 123  */
 124 typedef struct id_info {
 125         uid_t           id_uid;         /* user id */
 126         taskid_t        id_taskid;      /* task id */
 127         projid_t        id_projid;      /* project id */
 128         zoneid_t        id_zoneid;      /* zone id */
 129         int             id_lgroup;      /* lgroup id */
 130         uint_t          id_nproc;       /* number of processes */
 131         boolean_t       id_sizematch;   /* size/rssize from getvmusage() */
 132         size_t          id_size;        /* memory usage */
 133         size_t          id_rssize;      /* resident set size */
 134         ulong_t         id_time;        /* cpu time (in secs) */
 135         float           id_pctcpu;      /* percentage of cpu usage */


 150         void            *l_head;        /* pointer to the head of the list */
 151         void            *l_tail;        /* pointer to the tail of the list */
 152 
 153         int             l_size;         /* number of allocated pointers */
 154         int             l_used;         /* number of used pointers */
 155         int             l_sortorder;    /* sorting order for the list */
 156         keyfunc_t       l_func;         /* pointer to key function */
 157         void            **l_ptrs;       /* pointer to an array of pointers */
 158 } list_t;
 159 
 160 /*
 161  * Command line options
 162  */
 163 typedef struct optdesc {
 164         int             o_interval;     /* interval between updates */
 165         int             o_ntop;         /* number of lines in top half */
 166         int             o_nbottom;      /* number of lines in bottom half */
 167         int             o_count;        /* number of iterations */
 168         int             o_outpmode;     /* selected output mode */
 169         int             o_sortorder;    /* +1 ascending, -1 descending */

 170 } optdesc_t;
 171 


 172 #ifdef  __cplusplus
 173 }
 174 #endif
 175 
 176 #endif  /* _PRSTAT_H */


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2013 Gary Mills
  24  *
  25  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  *
  28  * Portions Copyright 2009 Chad Mynhier
  29  * Copyright 2018 Joyent, Inc.  All rights reserved.
  30  */
  31 
  32 #ifndef _PRSTAT_H
  33 #define _PRSTAT_H
  34 
  35 #include <sys/sysmacros.h>
  36 #include <sys/time.h>
  37 #include <sys/types.h>
  38 #include <procfs.h>
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * FRC2PCT macro is used to convert 16-bit binary fractions in the range
  46  * 0.0 to 1.0 with binary point to the right of the high order bit
  47  * (i.e. 1.0 == 0x8000) to percentage value.
  48  */
  49 


  97 /*
  98  * Linked list of per-process or per-lwp statistics
  99  */
 100 typedef struct lwp_info {
 101         psinfo_t        li_info;        /* data read from psinfo file */
 102         prusage_t       li_usage;       /* data read from usage file */
 103         ulong_t         li_key;         /* value of the key for this lwp */
 104         int             li_flags;       /* process/lwp flags */
 105         float           li_usr;         /* user level CPU time */
 106         float           li_sys;         /* system call CPU time */
 107         float           li_trp;         /* other system trap CPU time */
 108         float           li_tfl;         /* text page fault sleep time */
 109         float           li_dfl;         /* data page fault sleep time */
 110         float           li_lck;         /* user lock wait sleep time */
 111         float           li_slp;         /* all other sleep time */
 112         float           li_lat;         /* wait-cpu (latency) time */
 113         ulong_t         li_vcx;         /* voluntary context switches */
 114         ulong_t         li_icx;         /* involuntary context switches */
 115         ulong_t         li_scl;         /* system calls */
 116         ulong_t         li_sig;         /* received signals */
 117         char            li_lwpname[THREAD_NAME_MAX];
 118         struct lwp_info *li_next;       /* pointer to next lwp */
 119         struct lwp_info *li_prev;       /* pointer to previous lwp */
 120 } lwp_info_t;
 121 
 122 /*
 123  * Linked list of collective per-uid, per-taskid, per-projid or per-lgroup
 124  * statistics
 125  */
 126 typedef struct id_info {
 127         uid_t           id_uid;         /* user id */
 128         taskid_t        id_taskid;      /* task id */
 129         projid_t        id_projid;      /* project id */
 130         zoneid_t        id_zoneid;      /* zone id */
 131         int             id_lgroup;      /* lgroup id */
 132         uint_t          id_nproc;       /* number of processes */
 133         boolean_t       id_sizematch;   /* size/rssize from getvmusage() */
 134         size_t          id_size;        /* memory usage */
 135         size_t          id_rssize;      /* resident set size */
 136         ulong_t         id_time;        /* cpu time (in secs) */
 137         float           id_pctcpu;      /* percentage of cpu usage */


 152         void            *l_head;        /* pointer to the head of the list */
 153         void            *l_tail;        /* pointer to the tail of the list */
 154 
 155         int             l_size;         /* number of allocated pointers */
 156         int             l_used;         /* number of used pointers */
 157         int             l_sortorder;    /* sorting order for the list */
 158         keyfunc_t       l_func;         /* pointer to key function */
 159         void            **l_ptrs;       /* pointer to an array of pointers */
 160 } list_t;
 161 
 162 /*
 163  * Command line options
 164  */
 165 typedef struct optdesc {
 166         int             o_interval;     /* interval between updates */
 167         int             o_ntop;         /* number of lines in top half */
 168         int             o_nbottom;      /* number of lines in bottom half */
 169         int             o_count;        /* number of iterations */
 170         int             o_outpmode;     /* selected output mode */
 171         int             o_sortorder;    /* +1 ascending, -1 descending */
 172         int             o_cols;         /* number of columns */
 173 } optdesc_t;
 174 
 175 extern optdesc_t opts;
 176 
 177 #ifdef  __cplusplus
 178 }
 179 #endif
 180 
 181 #endif  /* _PRSTAT_H */