~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/daemons/execd/exec_ifm.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      File:           execd_ifm.h
 
3
 *
 
4
 *      Subsystem:      Archive Workstation Data Collection Supervisor.
 
5
 *
 
6
 *      Description:
 
7
 *      Definitions for the Data Collection Supervisor.
 
8
 *
 
9
 *      References:
 
10
 *
 
11
 */
 
12
 
 
13
#ifndef EXEC_IFM_H
 
14
#define EXEC_IFM_H
 
15
/*___INFO__MARK_BEGIN__*/
 
16
/*************************************************************************
 
17
 * 
 
18
 *  The Contents of this file are made available subject to the terms of
 
19
 *  the Sun Industry Standards Source License Version 1.2
 
20
 * 
 
21
 *  Sun Microsystems Inc., March, 2001
 
22
 * 
 
23
 * 
 
24
 *  Sun Industry Standards Source License Version 1.2
 
25
 *  =================================================
 
26
 *  The contents of this file are subject to the Sun Industry Standards
 
27
 *  Source License Version 1.2 (the "License"); You may not use this file
 
28
 *  except in compliance with the License. You may obtain a copy of the
 
29
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
30
 * 
 
31
 *  Software provided under this License is provided on an "AS IS" basis,
 
32
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
33
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
34
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
35
 *  See the License for the specific provisions governing your rights and
 
36
 *  obligations concerning the Software.
 
37
 * 
 
38
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
39
 * 
 
40
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
41
 * 
 
42
 *   All Rights Reserved.
 
43
 * 
 
44
 ************************************************************************/
 
45
/*___INFO__MARK_END__*/
 
46
 
 
47
/* Structures. */
 
48
 
 
49
/*
 
50
 * The following structures are used to transmit the process, job, and system
 
51
 * data gathered by the DC.  They are sent raw to the execd when requested.
 
52
 * These are not the internally-used structures.
 
53
 */
 
54
 
 
55
struct pkt_hdr
 
56
        {
 
57
        uint64  len;
 
58
        char pktype;    
 
59
        char unused[7];
 
60
        };
 
61
/*
 
62
 * Process data.  An array of jd_proccount of these structures is sent
 
63
 * after each job structure, and represents the processes "owned" by a job.
 
64
 */
 
65
struct psProc_s
 
66
        {
 
67
        long    pd_length;              /* Length of struct (set@run-time) */
 
68
        pid_t   pd_pid;
 
69
        time_t  pd_tstamp;              /* Timestamp of last update */
 
70
        uid_t   pd_uid;                 /* user ID of this proc */
 
71
        gid_t   pd_gid;                 /* group ID of this proc */
 
72
        uint64  pd_acid;                /* Account ID of this proc */
 
73
        long    pd_state;               /* 0: unknown 1:active 2:complete */
 
74
                                        /* (unknown is *bad*) */
 
75
        double  pd_pstart;              /* Start time of the process */
 
76
        double  pd_utime;               /* total user time used */
 
77
        double  pd_stime;               /* total system time used */
 
78
        };
 
79
/*
 
80
 * Job data.  This structure contains the cumulative job data for the
 
81
 * jd_jid job.  An array of psProc_s structures follows immediately after
 
82
 * this in the data stream.  jd_proccount tells how many psProc_s structures
 
83
 * follow.  They represent the processes "owned" by a job.
 
84
 *
 
85
 * Note that some of the data is derived from the completed process/session
 
86
 * data, and can vary for the procs.  For instance the acid of some procs can be
 
87
 * different from others, and the acid in the job record is what is reported
 
88
 * by the OS on job completion, or derived from the first proc seen if not
 
89
 * available from the OS.
 
90
 */
 
91
struct psJob_s
 
92
        {
 
93
        int     jd_length;                 /* Length of struct (set@run-time) */
 
94
                                                    /* includes length of trailing procs */
 
95
        JobID_t jd_jid;                 /* Job ID */
 
96
        uid_t   jd_uid;                    /* user ID of this job */
 
97
        gid_t   jd_gid;                    /* group ID of this job */
 
98
        uint64  jd_acid;                   /* Account ID of this job */
 
99
        time_t  jd_tstamp;              /* Timestamp of last update */
 
100
        long    jd_proccount;           /* attached process count (in list) */
 
101
        long    jd_refcnt;                 /* attached process count (from OS) */
 
102
        double  jd_etime;               /* Elapsed time of the job */
 
103
/*
 
104
 *      _c = complete procs.  _a = active procs.
 
105
 *      _c is a running total, and _a is current procs.
 
106
 */
 
107
        double  jd_utime_a;             /* total user time used */
 
108
        double  jd_stime_a;             /* total system time used */
 
109
        double  jd_bwtime_a;            /* total time waiting for block I/O used */
 
110
        double  jd_rwtime_a;            /* total time waiting for raw I/O used */
 
111
        double  jd_srtime_a;            /* total srun-wait time used */
 
112
        /* completed */
 
113
        double  jd_utime_c;             /* total user time used */
 
114
        double  jd_stime_c;             /* total system time used */
 
115
        double  jd_bwtime_c;            /* total time waiting for block I/O used */
 
116
        double  jd_rwtime_c;            /* total time waiting for raw I/O used */
 
117
        double  jd_srtime_c;            /* total srun-wait time used */
 
118
 
 
119
        uint64  jd_mem;                 /* memory used (integral) in KB seconds */
 
120
        uint64  jd_chars;               /* characters moved in bytes */
 
121
 
 
122
        uint64  jd_vmem;                   /* virtual memory size in bytes */
 
123
        uint64  jd_rss;            /* resident set size in bytes */
 
124
        uint64  jd_himem;               /* high-water memory size in bytes */
 
125
        uint64  jd_fsblks;              /* file system blocks consumed */
 
126
        };
 
127
/*
 
128
 * System info
 
129
 * This is the statistical information for the system.  It is sent in
 
130
 * response to the psGetSysdata() call.  It includes two numbers for
 
131
 * some of the counters.  One is the system's total, and the other is the
 
132
 * "new" accrual for this sampling interval.
 
133
 */
 
134
struct psSys_s
 
135
        {
 
136
        long    sys_length;             /* Length of struct (set@run-time) */
 
137
        long    sys_ncpus;              /* Number of CPUs */
 
138
        time_t  sys_tstamp;             /* Time of last snap */
 
139
        double  sys_ttimet;             /* total cpu time avail (since start) */
 
140
        double  sys_ttime;              /* total cpu time avail (this int) */
 
141
        double  sys_utimet;             /* user time (since start) */
 
142
        double  sys_utime;              /* user time this interval */
 
143
        double  sys_stimet;             /* system time (since start) */
 
144
        double  sys_stime;              /* system time this interval */
 
145
        double  sys_itimet;             /* idle time (since start) */
 
146
        double  sys_itime;              /* idle time this interval */
 
147
        double  sys_srtimet;            /* srun wait (since start) */
 
148
        double  sys_srtime;             /* srun wait this interval */
 
149
        double  sys_wtimet;             /* I/O wait time (since start) */
 
150
        double  sys_wtime;              /* I/O wait time this interval */
 
151
        uint64  sys_swp_total;          /* Total Swap space available */
 
152
        uint64  sys_swp_free;           /* Swap space free */
 
153
        uint64  sys_swp_used;           /* Swap space in use (bytes) */
 
154
        uint64  sys_swp_rsvd;           /* Swap space reserved (bytes) */
 
155
        uint64  sys_swp_virt;           /* Virtual Swap space avail (bytes) */
 
156
        double  sys_swp_rate;           /* Swap rate in bytes/second */
 
157
        uint64  sys_mem_avail;          /* Memory available (unused, free) */
 
158
        uint64  sys_mem_used;           /* Memory in use (bytes) */
 
159
        uint64  sys_mswp_avail;         /* Memory + swap available (bytes) */
 
160
        uint64  sys_mswp_used;          /* Memory + swap in use (bytes) */
 
161
 
 
162
/*
 
163
 *      The runque, runocc, swpque, swpocc numbers are already adjusted
 
164
 *      for number of CPUs.  A runocc value, of 1.0 for instance, means
 
165
 *      that there was a runnable process on every CPU at all times.
 
166
 *      A runque value of 2.0 means that *on average* there were 2 runnable
 
167
 *      procs on each CPU.  It is possible to have runocc of .5 and
 
168
 *      runque of 2.0 if the runqueue is about 4/CPU, but only
 
169
 *      half the time.  It is not possible to have runocc > runque.
 
170
 */
 
171
        double  sys_swpocc;             /* Swap "Occ" delta */
 
172
        double  sys_swpque;             /* Swap Queue delta */
 
173
        double  sys_runocc;             /* Run "Occ" delta */
 
174
        double  sys_runque;             /* Run Queue delta */
 
175
 
 
176
        uint64  sys_readch;             /* characters read */
 
177
        uint64  sys_writech;            /* characters written */
 
178
        };
 
179
 
 
180
struct psStat_s
 
181
        {
 
182
        long    stat_length;            /* Length of struct (set@run-time) */
 
183
        time_t  stat_tstamp;            /* Time of last sample */
 
184
                                        /* not necessarily complete */
 
185
        pid_t   stat_ifmpid;            /* our pid */
 
186
        pid_t   stat_DCpid;             /* DC pid */
 
187
        pid_t   stat_IFMpid;            /* IFM pid */
 
188
        long    stat_elapsed;           /* elapsed time (to *now*, not snap) */
 
189
        double  stat_DCutime;           /* user CPU time used by DC */
 
190
        double  stat_DCstime;           /* sys CPU time used by DC */
 
191
        double  stat_IFMutime;          /* user CPU time used by IFM */
 
192
        double  stat_IFMstime;          /* sys CPU time used by IFM */
 
193
        long    stat_jobcount;          /* number of jobs tracked */
 
194
        };
 
195
 
 
196
/* Functions. */
 
197
        /* None */
 
198
 
 
199
/* Function macros. */
 
200
        /* None */
 
201
 
 
202
/* Macros. */
 
203
 
 
204
/*
 
205
 * Commands to the IFM
 
206
 * To avoid sign extension and printf problems, all jobIDs are 16 chars
 
207
 * of Hex
 
208
 */
 
209
#define PS_IFM_START    's'
 
210
#define PS_IFM_QUIT     'q'     /* 'q'          Quit */
 
211
#define PS_IFM_TRACK    't'     /* 't ID'       track a job */
 
212
#define PS_IFM_IGNORE   'i'     /* 'i ID'       track a job */
 
213
#define PS_IFM_STATUS   '?'     /* '?'          Request DC status */
 
214
#define PS_IFM_1JOB     '1'     /* '1 ID'       Get info for 1 job */
 
215
#define PS_IFM_ALL      'a'     /* 'a'          get info for all jobs */
 
216
#define PS_IFM_SYSTEM   'l'     /* 'l'          get info (load) for system */
 
217
 
 
218
#define PS_IFM_ACK      'A'     /* ACK string (seldom used) */
 
219
#define PS_IFM_NACK     'N'     /* ACK string (seldom used) */
 
220
 
 
221
#endif /* EXEC_IFM_H */