mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
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_;
|
||||
|
||||
typedef struct Process_ {
|
||||
/* Super object for emulated OOP */
|
||||
Object super;
|
||||
|
||||
/* Pointer to quasi-global data structures */
|
||||
const struct ProcessList_* processList;
|
||||
const struct Settings_* settings;
|
||||
|
||||
/* Process runtime (in hundredth of a second) */
|
||||
unsigned long long int time;
|
||||
|
||||
/* Process identifier */
|
||||
pid_t pid;
|
||||
|
||||
/* Parent process identifier */
|
||||
pid_t ppid;
|
||||
|
||||
/* Thread group identifier */
|
||||
pid_t tgid;
|
||||
char* comm; /* use Process_getCommand() for Command actually displayed */
|
||||
int indent;
|
||||
|
||||
int basenameOffset;
|
||||
bool updated;
|
||||
|
||||
char state;
|
||||
bool tag;
|
||||
bool showChildren;
|
||||
bool show;
|
||||
bool wasShown;
|
||||
/* Process group identifier */
|
||||
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;
|
||||
float percent_mem;
|
||||
/* Session identifier */
|
||||
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;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/* Nice value */
|
||||
long int nice;
|
||||
|
||||
/* Number of threads in this process */
|
||||
long int nlwp;
|
||||
char starttime_show[8];
|
||||
|
||||
/* Process start time (in seconds elapsed since the Epoch) */
|
||||
time_t starttime_ctime;
|
||||
|
||||
/* Process start time (cached formatted string) */
|
||||
char starttime_show[8];
|
||||
|
||||
/* Total program size (in kilobytes) */
|
||||
long m_virt;
|
||||
|
||||
/* Resident set size (in kilobytes) */
|
||||
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 tombTs;
|
||||
|
||||
unsigned long int minflt;
|
||||
unsigned long int majflt;
|
||||
|
||||
/*
|
||||
* Internal state for tree-mode.
|
||||
*/
|
||||
int indent;
|
||||
unsigned int tree_left;
|
||||
unsigned int tree_right;
|
||||
unsigned int tree_depth;
|
||||
@ -112,11 +188,22 @@ typedef struct Process_ {
|
||||
} Process;
|
||||
|
||||
typedef struct ProcessFieldData_ {
|
||||
/* Name (displayed in setup menu) */
|
||||
const char* name;
|
||||
|
||||
/* Title (display in main screen); must have same width as the printed values */
|
||||
const char* title;
|
||||
|
||||
/* Description (displayed in setup menu) */
|
||||
const char* description;
|
||||
|
||||
/* Scan flag to enable scan-method otherwise not run */
|
||||
uint32_t flags;
|
||||
|
||||
/* Whether the values are process identifies; adjusts the width of title and values if true */
|
||||
bool pidColumn;
|
||||
|
||||
/* Whether the column should be sorted in descending order by default */
|
||||
bool defaultSortDesc;
|
||||
} ProcessFieldData;
|
||||
|
||||
|
@ -317,8 +317,10 @@ static bool LinuxProcessList_readStatFile(Process* process, openat_arg_t procFd,
|
||||
location += 1;
|
||||
process->tpgid = strtol(location, &location, 10);
|
||||
location += 1;
|
||||
process->flags = strtoul(location, &location, 10);
|
||||
location += 1;
|
||||
|
||||
/* Skip flags */
|
||||
location = strchr(location, ' ') + 1;
|
||||
|
||||
process->minflt = strtoull(location, &location, 10);
|
||||
location += 1;
|
||||
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++) {
|
||||
location = strchr(location, ' ') + 1;
|
||||
}
|
||||
process->exit_signal = strtol(location, &location, 10);
|
||||
location += 1;
|
||||
|
||||
/* Skip exit_signal */
|
||||
location = strchr(location, ' ') + 1;
|
||||
|
||||
assert(location != NULL);
|
||||
process->processor = strtol(location, &location, 10);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user