add proc_state.processor

This commit is contained in:
Doug MacEachern 2005-11-23 03:09:59 +00:00
parent 2a460dbff6
commit 5df9096cba
2 changed files with 23 additions and 1 deletions

View File

@ -627,6 +627,23 @@ static int proc_stat_read(sigar_t *sigar, sigar_pid_t pid)
pstat->vsize = sigar_strtoul(ptr); pstat->vsize = sigar_strtoul(ptr);
pstat->rss = pageshift(sigar_strtoul(ptr)); pstat->rss = pageshift(sigar_strtoul(ptr));
ptr = sigar_skip_token(ptr); /* startcode */
ptr = sigar_skip_token(ptr); /* endcode */
ptr = sigar_skip_token(ptr); /* startstack */
ptr = sigar_skip_token(ptr); /* kstkesp */
ptr = sigar_skip_token(ptr); /* kstkeip */
ptr = sigar_skip_token(ptr); /* signal */
ptr = sigar_skip_token(ptr); /* blocked */
ptr = sigar_skip_token(ptr); /* sigignore */
ptr = sigar_skip_token(ptr); /* sigcache */
ptr = sigar_skip_token(ptr); /* wchan */
ptr = sigar_skip_token(ptr); /* nswap */
ptr = sigar_skip_token(ptr); /* cnswap */
ptr = sigar_skip_token(ptr); /* exit_signal */
ptr = sigar_skip_token(ptr);
pstat->processor = sigar_strtoul(ptr);
return SIGAR_OK; return SIGAR_OK;
} }
@ -736,7 +753,11 @@ int sigar_proc_state_get(sigar_t *sigar, sigar_pid_t pid,
procstate->tty = pstat->tty; procstate->tty = pstat->tty;
procstate->priority = pstat->priority; procstate->priority = pstat->priority;
procstate->nice = pstat->nice; procstate->nice = pstat->nice;
procstate->processor = SIGAR_FIELD_NOTIMPL; procstate->processor = pstat->processor;
if (is_ht_enabled(sigar)) {
procstate->processor /= sigar->lcpu;
}
proc_status_get(sigar, pid, procstate); proc_status_get(sigar, pid, procstate);

View File

@ -28,6 +28,7 @@ typedef struct {
sigar_uint64_t stime; sigar_uint64_t stime;
char name[SIGAR_PROC_NAME_LEN]; char name[SIGAR_PROC_NAME_LEN];
char state; char state;
int processor;
} linux_proc_stat_t; } linux_proc_stat_t;
typedef enum { typedef enum {