mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-24 15:15:44 +00:00
Rework TTY column for the PCP platform
This commit is contained in:
parent
9ce9557e69
commit
4d7cee56f0
@ -32,7 +32,7 @@ const ProcessFieldData Process_fields[] = {
|
||||
[PPID] = { .name = "PPID", .title = "PPID", .description = "Parent process ID", .flags = 0, },
|
||||
[PGRP] = { .name = "PGRP", .title = "PGRP", .description = "Process group ID", .flags = 0, },
|
||||
[SESSION] = { .name = "SESSION", .title = "SID", .description = "Process's session ID", .flags = 0, },
|
||||
[TTY_NR] = { .name = "TTY_NR", .title = "TTY ", .description = "Controlling terminal", .flags = 0, },
|
||||
[TTY] = { .name = "TTY", .title = "TTY ", .description = "Controlling terminal", .flags = 0, },
|
||||
[TPGID] = { .name = "TPGID", .title = "TPGID", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, },
|
||||
[MINFLT] = { .name = "MINFLT", .title = " MINFLT ", .description = "Number of minor faults which have not required loading a memory page from disk", .flags = 0, .defaultSortDesc = true, },
|
||||
[CMINFLT] = { .name = "CMINFLT", .title = " CMINFLT ", .description = "Children processes' minor faults", .flags = 0, .defaultSortDesc = true, },
|
||||
@ -107,7 +107,6 @@ void Process_delete(Object* cast) {
|
||||
Process_done((Process*)cast);
|
||||
free(this->cgroup);
|
||||
free(this->secattr);
|
||||
free(this->ttyDevice);
|
||||
free(this->procComm);
|
||||
free(this->mergedCommand.str);
|
||||
free(this);
|
||||
@ -332,13 +331,6 @@ static void PCPProcess_writeField(const Process* this, RichString* str, ProcessF
|
||||
int attr = CRT_colors[DEFAULT_COLOR];
|
||||
int n = sizeof(buffer) - 1;
|
||||
switch ((int)field) {
|
||||
case TTY_NR:
|
||||
if (pp->ttyDevice) {
|
||||
xSnprintf(buffer, n, "%-8s", pp->ttyDevice + 5 /* skip "/dev/" */);
|
||||
break;
|
||||
}
|
||||
Process_writeField(this, str, field);
|
||||
break;
|
||||
case CMINFLT: Process_colorNumber(str, pp->cminflt, coloring); return;
|
||||
case CMAJFLT: Process_colorNumber(str, pp->cmajflt, coloring); return;
|
||||
case M_DRS: Process_humanNumber(str, pp->m_drs, coloring); return;
|
||||
|
@ -98,7 +98,6 @@ typedef struct PCPProcess_ {
|
||||
double io_rate_write_bps;
|
||||
char* cgroup;
|
||||
unsigned int oom;
|
||||
char* ttyDevice;
|
||||
unsigned long long int delay_read_time;
|
||||
unsigned long long cpu_delay_total;
|
||||
unsigned long long blkio_delay_total;
|
||||
|
@ -352,8 +352,8 @@ static char* setString(Metric metric, int pid, int offset, char* string) {
|
||||
return string;
|
||||
}
|
||||
|
||||
static void PCPProcessList_updateTTY(PCPProcess* process, int pid, int offset) {
|
||||
process->ttyDevice = setString(PCP_PROC_TTYNAME, pid, offset, process->ttyDevice);
|
||||
static void PCPProcessList_updateTTY(Process* process, int pid, int offset) {
|
||||
process->tty_name = setString(PCP_PROC_TTYNAME, pid, offset, process->tty_name);
|
||||
}
|
||||
|
||||
static void PCPProcessList_readCGroups(PCPProcess* process, int pid, int offset) {
|
||||
@ -495,7 +495,7 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this, double period,
|
||||
PCPProcessList_updateInfo(proc, pid, offset, command, sizeof(command));
|
||||
proc->starttime_ctime += Platform_getBootTime();
|
||||
if (tty_nr != proc->tty_nr)
|
||||
PCPProcessList_updateTTY(pp, pid, offset);
|
||||
PCPProcessList_updateTTY(proc, pid, offset);
|
||||
|
||||
float percent_cpu = (pp->utime + pp->stime - lasttimes) / period * 100.0;
|
||||
proc->percent_cpu = isnan(percent_cpu) ?
|
||||
|
Loading…
Reference in New Issue
Block a user