mirror of https://github.com/xzeldon/htop.git
Process: document process fields
Drop unused fields 'flags' and 'exit_signal'
This commit is contained in:
parent
93378b9ee5
commit
03d6345c89
133
Process.h
133
Process.h
|
@ -56,55 +56,131 @@ typedef enum ProcessField_ {
|
||||||
struct Settings_;
|
struct Settings_;
|
||||||
|
|
||||||
typedef struct Process_ {
|
typedef struct Process_ {
|
||||||
|
/* Super object for emulated OOP */
|
||||||
Object super;
|
Object super;
|
||||||
|
|
||||||
|
/* Pointer to quasi-global data structures */
|
||||||
const struct ProcessList_* processList;
|
const struct ProcessList_* processList;
|
||||||
const struct Settings_* settings;
|
const struct Settings_* settings;
|
||||||
|
|
||||||
|
/* Process runtime (in hundredth of a second) */
|
||||||
unsigned long long int time;
|
unsigned long long int time;
|
||||||
|
|
||||||
|
/* Process identifier */
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
/* Parent process identifier */
|
||||||
pid_t ppid;
|
pid_t ppid;
|
||||||
|
|
||||||
|
/* Thread group identifier */
|
||||||
pid_t tgid;
|
pid_t tgid;
|
||||||
char* comm; /* use Process_getCommand() for Command actually displayed */
|
|
||||||
int indent;
|
|
||||||
|
|
||||||
int basenameOffset;
|
/* Process group identifier */
|
||||||
bool updated;
|
|
||||||
|
|
||||||
char state;
|
|
||||||
bool tag;
|
|
||||||
bool showChildren;
|
|
||||||
bool show;
|
|
||||||
bool wasShown;
|
|
||||||
unsigned int pgrp;
|
unsigned int pgrp;
|
||||||
unsigned int session;
|
|
||||||
unsigned int tty_nr;
|
|
||||||
int tpgid;
|
|
||||||
uid_t st_uid;
|
|
||||||
unsigned long int flags;
|
|
||||||
int processor;
|
|
||||||
|
|
||||||
float percent_cpu;
|
/* Session identifier */
|
||||||
float percent_mem;
|
unsigned int session;
|
||||||
|
|
||||||
|
/* Foreground group identifier of the controlling terminal */
|
||||||
|
int tpgid;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Controlling terminal of the process.
|
||||||
|
* The minor device number is contained in the combination of bits 31 to 20 and 7 to 0; the major device number is in bits 15 to 8.
|
||||||
|
* */
|
||||||
|
unsigned int tty_nr;
|
||||||
|
|
||||||
|
/* User identifier */
|
||||||
|
uid_t st_uid;
|
||||||
|
|
||||||
|
/* User name */
|
||||||
const char* user;
|
const char* user;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process name including arguments.
|
||||||
|
* Use Process_getCommand() for Command actually displayed.
|
||||||
|
*/
|
||||||
|
char* comm;
|
||||||
|
|
||||||
|
/* Offset in comm of the process basename */
|
||||||
|
int basenameOffset;
|
||||||
|
|
||||||
|
/* CPU number last executed on */
|
||||||
|
int processor;
|
||||||
|
|
||||||
|
/* CPU usage during last cycle (in percent) */
|
||||||
|
float percent_cpu;
|
||||||
|
|
||||||
|
/* Memory usage during last cycle (in percent) */
|
||||||
|
float percent_mem;
|
||||||
|
|
||||||
|
/* Scheduling priority */
|
||||||
long int priority;
|
long int priority;
|
||||||
|
|
||||||
|
/* Nice value */
|
||||||
long int nice;
|
long int nice;
|
||||||
|
|
||||||
|
/* Number of threads in this process */
|
||||||
long int nlwp;
|
long int nlwp;
|
||||||
char starttime_show[8];
|
|
||||||
|
/* Process start time (in seconds elapsed since the Epoch) */
|
||||||
time_t starttime_ctime;
|
time_t starttime_ctime;
|
||||||
|
|
||||||
|
/* Process start time (cached formatted string) */
|
||||||
|
char starttime_show[8];
|
||||||
|
|
||||||
|
/* Total program size (in kilobytes) */
|
||||||
long m_virt;
|
long m_virt;
|
||||||
|
|
||||||
|
/* Resident set size (in kilobytes) */
|
||||||
long m_resident;
|
long m_resident;
|
||||||
|
|
||||||
int exit_signal;
|
/* Number of minor faults the process has made which have not required loading a memory page from disk */
|
||||||
|
unsigned long int minflt;
|
||||||
|
|
||||||
|
/* Number of major faults the process has made which have required loading a memory page from disk */
|
||||||
|
unsigned long int majflt;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process state (platform dependent):
|
||||||
|
* D - Waiting
|
||||||
|
* I - Idle
|
||||||
|
* L - Acquiring lock
|
||||||
|
* R - Running
|
||||||
|
* S - Sleeping
|
||||||
|
* T - Stopped (on a signal)
|
||||||
|
* X - Dead
|
||||||
|
* Z - Zombie
|
||||||
|
* t - Tracing stop
|
||||||
|
* ? - Unknown
|
||||||
|
*/
|
||||||
|
char state;
|
||||||
|
|
||||||
|
/* Whether the process was updated during the current scan */
|
||||||
|
bool updated;
|
||||||
|
|
||||||
|
/* Whether the process was tagged by the user */
|
||||||
|
bool tag;
|
||||||
|
|
||||||
|
/* Whether to display this process */
|
||||||
|
bool show;
|
||||||
|
|
||||||
|
/* Whether this process was shown last cycle */
|
||||||
|
bool wasShown;
|
||||||
|
|
||||||
|
/* Whether to show children of this process in tree-mode */
|
||||||
|
bool showChildren;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Internal time counts for showing new and exited processes.
|
||||||
|
*/
|
||||||
time_t seenTs;
|
time_t seenTs;
|
||||||
time_t tombTs;
|
time_t tombTs;
|
||||||
|
|
||||||
unsigned long int minflt;
|
/*
|
||||||
unsigned long int majflt;
|
* Internal state for tree-mode.
|
||||||
|
*/
|
||||||
|
int indent;
|
||||||
unsigned int tree_left;
|
unsigned int tree_left;
|
||||||
unsigned int tree_right;
|
unsigned int tree_right;
|
||||||
unsigned int tree_depth;
|
unsigned int tree_depth;
|
||||||
|
@ -112,11 +188,22 @@ typedef struct Process_ {
|
||||||
} Process;
|
} Process;
|
||||||
|
|
||||||
typedef struct ProcessFieldData_ {
|
typedef struct ProcessFieldData_ {
|
||||||
|
/* Name (displayed in setup menu) */
|
||||||
const char* name;
|
const char* name;
|
||||||
|
|
||||||
|
/* Title (display in main screen); must have same width as the printed values */
|
||||||
const char* title;
|
const char* title;
|
||||||
|
|
||||||
|
/* Description (displayed in setup menu) */
|
||||||
const char* description;
|
const char* description;
|
||||||
|
|
||||||
|
/* Scan flag to enable scan-method otherwise not run */
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
|
/* Whether the values are process identifies; adjusts the width of title and values if true */
|
||||||
bool pidColumn;
|
bool pidColumn;
|
||||||
|
|
||||||
|
/* Whether the column should be sorted in descending order by default */
|
||||||
bool defaultSortDesc;
|
bool defaultSortDesc;
|
||||||
} ProcessFieldData;
|
} ProcessFieldData;
|
||||||
|
|
||||||
|
|
|
@ -317,8 +317,10 @@ static bool LinuxProcessList_readStatFile(Process* process, openat_arg_t procFd,
|
||||||
location += 1;
|
location += 1;
|
||||||
process->tpgid = strtol(location, &location, 10);
|
process->tpgid = strtol(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
process->flags = strtoul(location, &location, 10);
|
|
||||||
location += 1;
|
/* Skip flags */
|
||||||
|
location = strchr(location, ' ') + 1;
|
||||||
|
|
||||||
process->minflt = strtoull(location, &location, 10);
|
process->minflt = strtoull(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
lp->cminflt = strtoull(location, &location, 10);
|
lp->cminflt = strtoull(location, &location, 10);
|
||||||
|
@ -351,8 +353,10 @@ static bool LinuxProcessList_readStatFile(Process* process, openat_arg_t procFd,
|
||||||
for (int i = 0; i < 15; i++) {
|
for (int i = 0; i < 15; i++) {
|
||||||
location = strchr(location, ' ') + 1;
|
location = strchr(location, ' ') + 1;
|
||||||
}
|
}
|
||||||
process->exit_signal = strtol(location, &location, 10);
|
|
||||||
location += 1;
|
/* Skip exit_signal */
|
||||||
|
location = strchr(location, ' ') + 1;
|
||||||
|
|
||||||
assert(location != NULL);
|
assert(location != NULL);
|
||||||
process->processor = strtol(location, &location, 10);
|
process->processor = strtol(location, &location, 10);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue