mirror of https://github.com/xzeldon/htop.git
Whitespace and indentation issues
This commit is contained in:
parent
9a16b1079e
commit
b23f8235e2
2
IncSet.c
2
IncSet.c
|
@ -170,7 +170,7 @@ bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue
|
||||||
doSearch = false;
|
doSearch = false;
|
||||||
}
|
}
|
||||||
} else if (ch == KEY_RESIZE) {
|
} else if (ch == KEY_RESIZE) {
|
||||||
Panel_resize(panel, COLS, LINES-panel->y-1);
|
Panel_resize(panel, COLS, LINES - panel->y - 1);
|
||||||
} else {
|
} else {
|
||||||
if (mode->isFilter) {
|
if (mode->isFilter) {
|
||||||
filterChanged = true;
|
filterChanged = true;
|
||||||
|
|
|
@ -287,7 +287,7 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
if (indent & (1U << i))
|
if (indent & (1U << i))
|
||||||
maxIndent = i+1;
|
maxIndent = i + 1;
|
||||||
for (int i = 0; i < maxIndent - 1; i++) {
|
for (int i = 0; i < maxIndent - 1; i++) {
|
||||||
int written, ret;
|
int written, ret;
|
||||||
if (indent & (1 << i))
|
if (indent & (1 << i))
|
||||||
|
|
|
@ -182,7 +182,8 @@ static bool Settings_read(Settings* this, const char* fileName, int initialCpuCo
|
||||||
this->delay = atoi(option[1]);
|
this->delay = atoi(option[1]);
|
||||||
} else if (String_eq(option[0], "color_scheme")) {
|
} else if (String_eq(option[0], "color_scheme")) {
|
||||||
this->colorScheme = atoi(option[1]);
|
this->colorScheme = atoi(option[1]);
|
||||||
if (this->colorScheme < 0 || this->colorScheme >= LAST_COLORSCHEME) this->colorScheme = 0;
|
if (this->colorScheme < 0 || this->colorScheme >= LAST_COLORSCHEME)
|
||||||
|
this->colorScheme = 0;
|
||||||
} else if (String_eq(option[0], "enable_mouse")) {
|
} else if (String_eq(option[0], "enable_mouse")) {
|
||||||
this->enableMouse = atoi(option[1]);
|
this->enableMouse = atoi(option[1]);
|
||||||
} else if (String_eq(option[0], "left_meters")) {
|
} else if (String_eq(option[0], "left_meters")) {
|
||||||
|
|
|
@ -35,7 +35,9 @@ void GetKernelVersion(struct kern *k) {
|
||||||
char str[256] = {0};
|
char str[256] = {0};
|
||||||
size_t size = sizeof(str);
|
size_t size = sizeof(str);
|
||||||
int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0);
|
int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0);
|
||||||
if (ret == 0) sscanf(str, "%hd.%hd.%hd", &version_[0], &version_[1], &version_[2]);
|
if (ret == 0) {
|
||||||
|
sscanf(str, "%hd.%hd.%hd", &version_[0], &version_[1], &version_[2]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
memcpy(k->version, version_, sizeof(version_));
|
memcpy(k->version, version_, sizeof(version_));
|
||||||
}
|
}
|
||||||
|
@ -48,9 +50,17 @@ negative value if more than the installed version
|
||||||
int CompareKernelVersion(short int major, short int minor, short int component) {
|
int CompareKernelVersion(short int major, short int minor, short int component) {
|
||||||
struct kern k;
|
struct kern k;
|
||||||
GetKernelVersion(&k);
|
GetKernelVersion(&k);
|
||||||
if ( k.version[0] != major) return k.version[0] - major;
|
|
||||||
if ( k.version[1] != minor) return k.version[1] - minor;
|
if (k.version[0] != major) {
|
||||||
if ( k.version[2] != component) return k.version[2] - component;
|
return k.version[0] - major;
|
||||||
|
}
|
||||||
|
if (k.version[1] != minor) {
|
||||||
|
return k.version[1] - minor;
|
||||||
|
}
|
||||||
|
if (k.version[2] != component) {
|
||||||
|
return k.version[2] - component;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +86,7 @@ unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p) {
|
||||||
unsigned cpu_count;
|
unsigned cpu_count;
|
||||||
|
|
||||||
// TODO Improving the accuracy of the load counts woule help a lot.
|
// TODO Improving the accuracy of the load counts woule help a lot.
|
||||||
if (0 != host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &cpu_count, (processor_info_array_t *)p, &info_size)) {
|
if (0 != host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &cpu_count, (processor_info_array_t*)p, &info_size)) {
|
||||||
CRT_fatalError("Unable to retrieve CPU info\n");
|
CRT_fatalError("Unable to retrieve CPU info\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +96,9 @@ unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p) {
|
||||||
void ProcessList_getVMStats(vm_statistics_t p) {
|
void ProcessList_getVMStats(vm_statistics_t p) {
|
||||||
mach_msg_type_number_t info_size = HOST_VM_INFO_COUNT;
|
mach_msg_type_number_t info_size = HOST_VM_INFO_COUNT;
|
||||||
|
|
||||||
if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)p, &info_size) != 0)
|
if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)p, &info_size) != 0) {
|
||||||
CRT_fatalError("Unable to retrieve VM statistics\n");
|
CRT_fatalError("Unable to retrieve VM statistics\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count) {
|
struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count) {
|
||||||
|
@ -145,11 +156,11 @@ void ProcessList_delete(ProcessList* this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||||
DarwinProcessList *dpl = (DarwinProcessList *)super;
|
DarwinProcessList* dpl = (DarwinProcessList*)super;
|
||||||
bool preExisting = true;
|
bool preExisting = true;
|
||||||
struct kinfo_proc *ps;
|
struct kinfo_proc* ps;
|
||||||
size_t count;
|
size_t count;
|
||||||
DarwinProcess *proc;
|
DarwinProcess* proc;
|
||||||
|
|
||||||
/* Update the global data (CPU times and VM stats) */
|
/* Update the global data (CPU times and VM stats) */
|
||||||
ProcessList_freeCPULoadInfo(&dpl->prev_load);
|
ProcessList_freeCPULoadInfo(&dpl->prev_load);
|
||||||
|
@ -159,8 +170,9 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||||
openzfs_sysctl_updateArcStats(&dpl->zfs);
|
openzfs_sysctl_updateArcStats(&dpl->zfs);
|
||||||
|
|
||||||
// in pause mode only gather global data for meters (CPU/memory/...)
|
// in pause mode only gather global data for meters (CPU/memory/...)
|
||||||
if (pauseProcessUpdate)
|
if (pauseProcessUpdate) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the time difference */
|
/* Get the time difference */
|
||||||
dpl->global_diff = 0;
|
dpl->global_diff = 0;
|
||||||
|
@ -186,7 +198,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||||
ps = ProcessList_getKInfoProcs(&count);
|
ps = ProcessList_getKInfoProcs(&count);
|
||||||
|
|
||||||
for (size_t i = 0; i < count; ++i) {
|
for (size_t i = 0; i < count; ++i) {
|
||||||
proc = (DarwinProcess *)ProcessList_getProcess(super, ps[i].kp_proc.p_pid, &preExisting, DarwinProcess_new);
|
proc = (DarwinProcess*)ProcessList_getProcess(super, ps[i].kp_proc.p_pid, &preExisting, DarwinProcess_new);
|
||||||
|
|
||||||
DarwinProcess_setFromKInfoProc(&proc->super, &ps[i], preExisting);
|
DarwinProcess_setFromKInfoProc(&proc->super, &ps[i], preExisting);
|
||||||
DarwinProcess_setFromLibprocPidinfo(proc, dpl);
|
DarwinProcess_setFromLibprocPidinfo(proc, dpl);
|
||||||
|
@ -194,7 +206,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||||
// Disabled for High Sierra due to bug in macOS High Sierra
|
// Disabled for High Sierra due to bug in macOS High Sierra
|
||||||
bool isScanThreadSupported = ! ( CompareKernelVersion(17, 0, 0) >= 0 && CompareKernelVersion(17, 5, 0) < 0);
|
bool isScanThreadSupported = ! ( CompareKernelVersion(17, 0, 0) >= 0 && CompareKernelVersion(17, 5, 0) < 0);
|
||||||
|
|
||||||
if (isScanThreadSupported){
|
if (isScanThreadSupported) {
|
||||||
DarwinProcess_scanThreads(proc);
|
DarwinProcess_scanThreads(proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,11 +211,11 @@ double Platform_setCPUValues(Meter* mtr, int cpu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mtr->values[CPU_METER_NICE]
|
mtr->values[CPU_METER_NICE]
|
||||||
= ((double)curr->cpu_ticks[CPU_STATE_NICE] - (double)prev->cpu_ticks[CPU_STATE_NICE])* 100.0 / total;
|
= ((double)curr->cpu_ticks[CPU_STATE_NICE] - (double)prev->cpu_ticks[CPU_STATE_NICE]) * 100.0 / total;
|
||||||
mtr->values[CPU_METER_NORMAL]
|
mtr->values[CPU_METER_NORMAL]
|
||||||
= ((double)curr->cpu_ticks[CPU_STATE_USER] - (double)prev->cpu_ticks[CPU_STATE_USER])* 100.0 / total;
|
= ((double)curr->cpu_ticks[CPU_STATE_USER] - (double)prev->cpu_ticks[CPU_STATE_USER]) * 100.0 / total;
|
||||||
mtr->values[CPU_METER_KERNEL]
|
mtr->values[CPU_METER_KERNEL]
|
||||||
= ((double)curr->cpu_ticks[CPU_STATE_SYSTEM] - (double)prev->cpu_ticks[CPU_STATE_SYSTEM])* 100.0 / total;
|
= ((double)curr->cpu_ticks[CPU_STATE_SYSTEM] - (double)prev->cpu_ticks[CPU_STATE_SYSTEM]) * 100.0 / total;
|
||||||
|
|
||||||
mtr->curItems = 3;
|
mtr->curItems = 3;
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,7 @@ retry:
|
||||||
|
|
||||||
curpos = nextpos;
|
curpos = nextpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(jls);
|
free(jls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -379,7 +379,8 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
|
||||||
default:
|
default:
|
||||||
return Process_compare(v1, v2);
|
return Process_compare(v1, v2);
|
||||||
}
|
}
|
||||||
test_diff:
|
|
||||||
|
test_diff:
|
||||||
return (diff > 0) ? 1 : (diff < 0 ? -1 : 0);
|
return (diff > 0) ? 1 : (diff < 0 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,20 +419,20 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||||
while ((line = strsep(&buf, "\n")) != NULL) {
|
while ((line = strsep(&buf, "\n")) != NULL) {
|
||||||
switch (line[0]) {
|
switch (line[0]) {
|
||||||
case 'r':
|
case 'r':
|
||||||
if (line[1] == 'c' && String_startsWith(line+2, "har: "))
|
if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
|
||||||
process->io_rchar = strtoull(line+7, NULL, 10);
|
process->io_rchar = strtoull(line + 7, NULL, 10);
|
||||||
else if (String_startsWith(line+1, "ead_bytes: ")) {
|
} else if (String_startsWith(line + 1, "ead_bytes: ")) {
|
||||||
process->io_read_bytes = strtoull(line+12, NULL, 10);
|
process->io_read_bytes = strtoull(line + 12, NULL, 10);
|
||||||
process->io_rate_read_bps =
|
process->io_rate_read_bps =
|
||||||
((double)(process->io_read_bytes - last_read))/(((double)(now - process->io_rate_read_time))/1000);
|
((double)(process->io_read_bytes - last_read))/(((double)(now - process->io_rate_read_time))/1000);
|
||||||
process->io_rate_read_time = now;
|
process->io_rate_read_time = now;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
if (line[1] == 'c' && String_startsWith(line+2, "har: "))
|
if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
|
||||||
process->io_wchar = strtoull(line+7, NULL, 10);
|
process->io_wchar = strtoull(line + 7, NULL, 10);
|
||||||
else if (String_startsWith(line+1, "rite_bytes: ")) {
|
} else if (String_startsWith(line + 1, "rite_bytes: ")) {
|
||||||
process->io_write_bytes = strtoull(line+13, NULL, 10);
|
process->io_write_bytes = strtoull(line + 13, NULL, 10);
|
||||||
process->io_rate_write_bps =
|
process->io_rate_write_bps =
|
||||||
((double)(process->io_write_bytes - last_write))/(((double)(now - process->io_rate_write_time))/1000);
|
((double)(process->io_write_bytes - last_write))/(((double)(now - process->io_rate_write_time))/1000);
|
||||||
process->io_rate_write_time = now;
|
process->io_rate_write_time = now;
|
||||||
|
@ -446,8 +446,8 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
if (String_startsWith(line+1, "ancelled_write_bytes: ")) {
|
if (String_startsWith(line + 1, "ancelled_write_bytes: ")) {
|
||||||
process->io_cancelled_write_bytes = strtoull(line+23, NULL, 10);
|
process->io_cancelled_write_bytes = strtoull(line + 23, NULL, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1087,7 +1087,9 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Exception handler.
|
// Exception handler.
|
||||||
errorReadingProcess: {
|
|
||||||
|
errorReadingProcess:
|
||||||
|
{
|
||||||
if (preExisting) {
|
if (preExisting) {
|
||||||
ProcessList_remove(pl, proc);
|
ProcessList_remove(pl, proc);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -24,7 +24,7 @@ static const int PressureStallMeter_attributes[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void PressureStallMeter_updateValues(Meter* this, char* buffer, int len) {
|
static void PressureStallMeter_updateValues(Meter* this, char* buffer, int len) {
|
||||||
const char *file;
|
const char* file;
|
||||||
if (strstr(Meter_name(this), "CPU")) {
|
if (strstr(Meter_name(this), "CPU")) {
|
||||||
file = "cpu";
|
file = "cpu";
|
||||||
} else if (strstr(Meter_name(this), "IO")) {
|
} else if (strstr(Meter_name(this), "IO")) {
|
||||||
|
|
|
@ -32,127 +32,152 @@ ProcessFieldData Process_fields[] = {
|
||||||
.name = "",
|
.name = "",
|
||||||
.title = NULL,
|
.title = NULL,
|
||||||
.description = NULL,
|
.description = NULL,
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[PID] = {
|
[PID] = {
|
||||||
.name = "PID",
|
.name = "PID",
|
||||||
.title = " PID ",
|
.title = " PID ",
|
||||||
.description = "Process/thread ID",
|
.description = "Process/thread ID",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[COMM] = {
|
[COMM] = {
|
||||||
.name = "Command",
|
.name = "Command",
|
||||||
.title = "Command ",
|
.title = "Command ",
|
||||||
.description = "Command line",
|
.description = "Command line",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[STATE] = {
|
[STATE] = {
|
||||||
.name = "STATE",
|
.name = "STATE",
|
||||||
.title = "S ",
|
.title = "S ",
|
||||||
.description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)",
|
.description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[PPID] = {
|
[PPID] = {
|
||||||
.name = "PPID",
|
.name = "PPID",
|
||||||
.title = " PPID ",
|
.title = " PPID ",
|
||||||
.description = "Parent process ID",
|
.description = "Parent process ID",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[PGRP] = {
|
[PGRP] = {
|
||||||
.name = "PGRP",
|
.name = "PGRP",
|
||||||
.title = " PGRP ",
|
.title = " PGRP ",
|
||||||
.description = "Process group ID",
|
.description = "Process group ID",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[SESSION] = {
|
[SESSION] = {
|
||||||
.name = "SESSION",
|
.name = "SESSION",
|
||||||
.title = " SESN ",
|
.title = " SESN ",
|
||||||
.description = "Process's session ID",
|
.description = "Process's session ID",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[TTY_NR] = {
|
[TTY_NR] = {
|
||||||
.name = "TTY_NR",
|
.name = "TTY_NR",
|
||||||
.title = " TTY ",
|
.title = " TTY ",
|
||||||
.description = "Controlling terminal",
|
.description = "Controlling terminal",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[TPGID] = {
|
[TPGID] = {
|
||||||
.name = "TPGID",
|
.name = "TPGID",
|
||||||
.title = " TPGID ",
|
.title = " TPGID ",
|
||||||
.description = "Process ID of the fg process group of the controlling terminal",
|
.description = "Process ID of the fg process group of the controlling terminal",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[MINFLT] = {
|
[MINFLT] = {
|
||||||
.name = "MINFLT",
|
.name = "MINFLT",
|
||||||
.title = " MINFLT ",
|
.title = " MINFLT ",
|
||||||
.description = "Number of minor faults which have not required loading a memory page from disk",
|
.description = "Number of minor faults which have not required loading a memory page from disk",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[MAJFLT] = {
|
[MAJFLT] = {
|
||||||
.name = "MAJFLT",
|
.name = "MAJFLT",
|
||||||
.title = " MAJFLT ",
|
.title = " MAJFLT ",
|
||||||
.description = "Number of major faults which have required loading a memory page from disk",
|
.description = "Number of major faults which have required loading a memory page from disk",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[PRIORITY] = {
|
[PRIORITY] = {
|
||||||
.name = "PRIORITY",
|
.name = "PRIORITY",
|
||||||
.title = "PRI ",
|
.title = "PRI ",
|
||||||
.description = "Kernel's internal priority for the process",
|
.description = "Kernel's internal priority for the process",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[NICE] = {
|
[NICE] = {
|
||||||
.name = "NICE",
|
.name = "NICE",
|
||||||
.title = " NI ",
|
.title = " NI ",
|
||||||
.description = "Nice value (the higher the value, the more it lets other processes take priority)",
|
.description = "Nice value (the higher the value, the more it lets other processes take priority)",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[STARTTIME] = {
|
[STARTTIME] = {
|
||||||
.name = "STARTTIME",
|
.name = "STARTTIME",
|
||||||
.title = "START ",
|
.title = "START ",
|
||||||
.description = "Time the process was started",
|
.description = "Time the process was started",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[PROCESSOR] = {
|
[PROCESSOR] = {
|
||||||
.name = "PROCESSOR",
|
.name = "PROCESSOR",
|
||||||
.title = "CPU ",
|
.title = "CPU ",
|
||||||
.description = "Id of the CPU the process last executed on",
|
.description = "Id of the CPU the process last executed on",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[M_SIZE] = {
|
[M_SIZE] = {
|
||||||
.name = "M_SIZE",
|
.name = "M_SIZE",
|
||||||
.title = " VIRT ",
|
.title = " VIRT ",
|
||||||
.description = "Total program size in virtual memory",
|
.description = "Total program size in virtual memory",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[M_RESIDENT] = {
|
[M_RESIDENT] = {
|
||||||
.name = "M_RESIDENT",
|
.name = "M_RESIDENT",
|
||||||
.title = " RES ",
|
.title = " RES ",
|
||||||
.description = "Resident set size, size of the text and data sections, plus stack usage",
|
.description = "Resident set size, size of the text and data sections, plus stack usage",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[ST_UID] = {
|
[ST_UID] = {
|
||||||
.name = "ST_UID",
|
.name = "ST_UID",
|
||||||
.title = " UID ",
|
.title = " UID ",
|
||||||
.description = "User ID of the process owner",
|
.description = "User ID of the process owner",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[PERCENT_CPU] = {
|
[PERCENT_CPU] = {
|
||||||
.name = "PERCENT_CPU",
|
.name = "PERCENT_CPU",
|
||||||
.title = "CPU% ",
|
.title = "CPU% ",
|
||||||
.description = "Percentage of the CPU time the process used in the last sampling",
|
.description = "Percentage of the CPU time the process used in the last sampling",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[PERCENT_MEM] = {
|
[PERCENT_MEM] = {
|
||||||
.name = "PERCENT_MEM",
|
.name = "PERCENT_MEM",
|
||||||
.title = "MEM% ",
|
.title = "MEM% ",
|
||||||
.description = "Percentage of the memory the process is using, based on resident memory size",
|
.description = "Percentage of the memory the process is using, based on resident memory size",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[USER] = {
|
[USER] = {
|
||||||
.name = "USER",
|
.name = "USER",
|
||||||
.title = "USER ",
|
.title = "USER ",
|
||||||
.description = "Username of the process owner (or user ID if name cannot be determined)",
|
.description = "Username of the process owner (or user ID if name cannot be determined)",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[TIME] = {
|
[TIME] = {
|
||||||
.name = "TIME",
|
.name = "TIME",
|
||||||
.title = " TIME+ ",
|
.title = " TIME+ ",
|
||||||
.description = "Total time the process has spent in user and system time",
|
.description = "Total time the process has spent in user and system time",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[NLWP] = {
|
[NLWP] = {
|
||||||
.name = "NLWP",
|
.name = "NLWP",
|
||||||
.title = "NLWP ",
|
.title = "NLWP ",
|
||||||
.description = "Number of threads in the process",
|
.description = "Number of threads in the process",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[TGID] = {
|
[TGID] = {
|
||||||
.name = "TGID",
|
.name = "TGID",
|
||||||
.title = " TGID ",
|
.title = " TGID ",
|
||||||
.description = "Thread group ID (i.e. process ID)",
|
.description = "Thread group ID (i.e. process ID)",
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
[LAST_PROCESSFIELD] = {
|
[LAST_PROCESSFIELD] = {
|
||||||
.name = "*** report bug! ***",
|
.name = "*** report bug! ***",
|
||||||
.title = NULL,
|
.title = NULL,
|
||||||
.description = NULL,
|
.description = NULL,
|
||||||
.flags = 0, },
|
.flags = 0,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
ProcessPidColumn Process_pidColumns[] = {
|
ProcessPidColumn Process_pidColumns[] = {
|
||||||
|
|
|
@ -254,7 +254,7 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((kproc = kvm_getprocs(kt, KERN_PROC_PID, pid,
|
if ((kproc = kvm_getprocs(kt, KERN_PROC_PID, pid,
|
||||||
sizeof(struct kinfo_proc), &count)) == NULL) {\
|
sizeof(struct kinfo_proc), &count)) == NULL) {
|
||||||
(void) kvm_close(kt);
|
(void) kvm_close(kt);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
if (size + 2 < capacity)
|
if (size + 2 < capacity)
|
||||||
env = xRealloc(env, capacity + 2);
|
env = xRealloc(env, capacity + 2);
|
||||||
env[size] = 0;
|
env[size] = 0;
|
||||||
env[size+1] = 0;
|
env[size + 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) kvm_close(kt);
|
(void) kvm_close(kt);
|
||||||
|
|
|
@ -30,6 +30,7 @@ in the source distribution for its full text.
|
||||||
|
|
||||||
char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) {
|
char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) {
|
||||||
char* zname;
|
char* zname;
|
||||||
|
|
||||||
if ( sproc->zoneid == 0 ) {
|
if ( sproc->zoneid == 0 ) {
|
||||||
zname = xStrdup(GZONE);
|
zname = xStrdup(GZONE);
|
||||||
} else if ( kd == NULL ) {
|
} else if ( kd == NULL ) {
|
||||||
|
@ -38,6 +39,7 @@ char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) {
|
||||||
kstat_t* ks = kstat_lookup( kd, "zones", sproc->zoneid, NULL );
|
kstat_t* ks = kstat_lookup( kd, "zones", sproc->zoneid, NULL );
|
||||||
zname = xStrdup(ks == NULL ? UZONE : ks->ks_name);
|
zname = xStrdup(ks == NULL ? UZONE : ks->ks_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return zname;
|
return zname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,8 +87,12 @@ static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
|
||||||
|
|
||||||
// Calculate per-CPU statistics first
|
// Calculate per-CPU statistics first
|
||||||
for (int i = 0; i < cpus; i++) {
|
for (int i = 0; i < cpus; i++) {
|
||||||
if (spl->kd != NULL) { cpuinfo = kstat_lookup(spl->kd,"cpu",i,"sys"); }
|
if (spl->kd != NULL) {
|
||||||
if (cpuinfo != NULL) { kchain = kstat_read(spl->kd,cpuinfo,NULL); }
|
cpuinfo = kstat_lookup(spl->kd, "cpu", i, "sys");
|
||||||
|
}
|
||||||
|
if (cpuinfo != NULL) {
|
||||||
|
kchain = kstat_read(spl->kd, cpuinfo, NULL);
|
||||||
|
}
|
||||||
if (kchain != -1 ) {
|
if (kchain != -1 ) {
|
||||||
idletime = kstat_data_lookup(cpuinfo,"cpu_nsec_idle");
|
idletime = kstat_data_lookup(cpuinfo,"cpu_nsec_idle");
|
||||||
intrtime = kstat_data_lookup(cpuinfo,"cpu_nsec_intr");
|
intrtime = kstat_data_lookup(cpuinfo,"cpu_nsec_intr");
|
||||||
|
@ -180,8 +186,12 @@ static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) {
|
||||||
|
|
||||||
// Part 2 - swap
|
// Part 2 - swap
|
||||||
nswap = swapctl(SC_GETNSWP, NULL);
|
nswap = swapctl(SC_GETNSWP, NULL);
|
||||||
if (nswap > 0) { sl = xMalloc((nswap * sizeof(swapent_t)) + sizeof(int)); }
|
if (nswap > 0) {
|
||||||
if (sl != NULL) { spathbase = xMalloc( nswap * MAXPATHLEN ); }
|
sl = xMalloc((nswap * sizeof(swapent_t)) + sizeof(int));
|
||||||
|
}
|
||||||
|
if (sl != NULL) {
|
||||||
|
spathbase = xMalloc( nswap * MAXPATHLEN );
|
||||||
|
}
|
||||||
if (spathbase != NULL) {
|
if (spathbase != NULL) {
|
||||||
spath = spathbase;
|
spath = spathbase;
|
||||||
swapdev = sl->swt_ent;
|
swapdev = sl->swt_ent;
|
||||||
|
@ -211,8 +221,12 @@ static inline void SolarisProcessList_scanZfsArcstats(ProcessList* pl) {
|
||||||
int ksrphyserr = -1;
|
int ksrphyserr = -1;
|
||||||
kstat_named_t *cur_kstat = NULL;
|
kstat_named_t *cur_kstat = NULL;
|
||||||
|
|
||||||
if (spl->kd != NULL) { arcstats = kstat_lookup(spl->kd, "zfs", 0, "arcstats"); }
|
if (spl->kd != NULL) {
|
||||||
if (arcstats != NULL) { ksrphyserr = kstat_read(spl->kd, arcstats, NULL); }
|
arcstats = kstat_lookup(spl->kd, "zfs", 0, "arcstats");
|
||||||
|
}
|
||||||
|
if (arcstats != NULL) {
|
||||||
|
ksrphyserr = kstat_read(spl->kd, arcstats, NULL);
|
||||||
|
}
|
||||||
if (ksrphyserr != -1) {
|
if (ksrphyserr != -1) {
|
||||||
cur_kstat = kstat_data_lookup( arcstats, "size" );
|
cur_kstat = kstat_data_lookup( arcstats, "size" );
|
||||||
spl->zfs.size = cur_kstat->value.ui64 / 1024;
|
spl->zfs.size = cur_kstat->value.ui64 / 1024;
|
||||||
|
|
|
@ -31,7 +31,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool preExisting = true;
|
bool preExisting = true;
|
||||||
Process *proc;
|
Process* proc;
|
||||||
|
|
||||||
proc = ProcessList_getProcess(super, 1, &preExisting, UnsupportedProcess_new);
|
proc = ProcessList_getProcess(super, 1, &preExisting, UnsupportedProcess_new);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ void openzfs_sysctl_init(ZfsArcStats *stats) {
|
||||||
len = sizeof(arcSize);
|
len = sizeof(arcSize);
|
||||||
if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arcSize, &len, NULL, 0) == 0 && arcSize != 0) {
|
if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arcSize, &len, NULL, 0) == 0 && arcSize != 0) {
|
||||||
stats->enabled = 1;
|
stats->enabled = 1;
|
||||||
len = 5; sysctlnametomib("kstat.zfs.misc.arcstats.size", MIB_kstat_zfs_misc_arcstats_size, &len);
|
|
||||||
|
len = 5;
|
||||||
|
sysctlnametomib("kstat.zfs.misc.arcstats.size", MIB_kstat_zfs_misc_arcstats_size, &len);
|
||||||
|
|
||||||
sysctlnametomib("kstat.zfs.misc.arcstats.c_max", MIB_kstat_zfs_misc_arcstats_c_max, &len);
|
sysctlnametomib("kstat.zfs.misc.arcstats.c_max", MIB_kstat_zfs_misc_arcstats_c_max, &len);
|
||||||
sysctlnametomib("kstat.zfs.misc.arcstats.mfu_size", MIB_kstat_zfs_misc_arcstats_mfu_size, &len);
|
sysctlnametomib("kstat.zfs.misc.arcstats.mfu_size", MIB_kstat_zfs_misc_arcstats_mfu_size, &len);
|
||||||
|
@ -42,6 +44,7 @@ void openzfs_sysctl_init(ZfsArcStats *stats) {
|
||||||
sysctlnametomib("kstat.zfs.misc.arcstats.anon_size", MIB_kstat_zfs_misc_arcstats_anon_size, &len);
|
sysctlnametomib("kstat.zfs.misc.arcstats.anon_size", MIB_kstat_zfs_misc_arcstats_anon_size, &len);
|
||||||
sysctlnametomib("kstat.zfs.misc.arcstats.hdr_size", MIB_kstat_zfs_misc_arcstats_hdr_size, &len);
|
sysctlnametomib("kstat.zfs.misc.arcstats.hdr_size", MIB_kstat_zfs_misc_arcstats_hdr_size, &len);
|
||||||
sysctlnametomib("kstat.zfs.misc.arcstats.other_size", MIB_kstat_zfs_misc_arcstats_other_size, &len);
|
sysctlnametomib("kstat.zfs.misc.arcstats.other_size", MIB_kstat_zfs_misc_arcstats_other_size, &len);
|
||||||
|
|
||||||
if (sysctlnametomib("kstat.zfs.misc.arcstats.compressed_size", MIB_kstat_zfs_misc_arcstats_compressed_size, &len) == 0) {
|
if (sysctlnametomib("kstat.zfs.misc.arcstats.compressed_size", MIB_kstat_zfs_misc_arcstats_compressed_size, &len) == 0) {
|
||||||
stats->isCompressed = 1;
|
stats->isCompressed = 1;
|
||||||
sysctlnametomib("kstat.zfs.misc.arcstats.uncompressed_size", MIB_kstat_zfs_misc_arcstats_uncompressed_size, &len);
|
sysctlnametomib("kstat.zfs.misc.arcstats.uncompressed_size", MIB_kstat_zfs_misc_arcstats_uncompressed_size, &len);
|
||||||
|
|
Loading…
Reference in New Issue