Commit 23798359 authored by Martin "eto" Misuth's avatar Martin "eto" Misuth
Browse files

Added platform dependent DEFAULT_SIGNAL define, for now for:

FreeBSD
Linux
Other platforms will have it undefined for now.
parent 86417e41
...@@ -31,6 +31,6 @@ Panel* SignalsPanel_new() { ...@@ -31,6 +31,6 @@ Panel* SignalsPanel_new() {
for(unsigned int i = 0; i < Platform_numberOfSignals; i++) for(unsigned int i = 0; i < Platform_numberOfSignals; i++)
Panel_set(this, i, (Object*) ListItem_new(Platform_signals[i].name, Platform_signals[i].number)); Panel_set(this, i, (Object*) ListItem_new(Platform_signals[i].name, Platform_signals[i].number));
Panel_setHeader(this, "Send signal:"); Panel_setHeader(this, "Send signal:");
Panel_setSelected(this, 16); // 16th item is SIGTERM Panel_setSelected(this, DEFAULT_SIGNAL);
return this; return this;
} }
...@@ -31,6 +31,10 @@ in the source distribution for its full text. ...@@ -31,6 +31,10 @@ in the source distribution for its full text.
extern ProcessFieldData Process_fields[]; extern ProcessFieldData Process_fields[];
#ifndef DEFAULT_SIGNAL
#define DEFAULT_SIGNAL 15
#endif
static SignalItem Platform_signals[] = { static SignalItem Platform_signals[] = {
{ .name = " 0 Cancel", .number = 0 }, { .name = " 0 Cancel", .number = 0 },
{ .name = " 1 SIGHUP", .number = 1 }, { .name = " 1 SIGHUP", .number = 1 },
......
...@@ -32,6 +32,11 @@ in the source distribution for its full text. ...@@ -32,6 +32,11 @@ in the source distribution for its full text.
#include "BatteryMeter.h" #include "BatteryMeter.h"
#include "LinuxProcess.h" #include "LinuxProcess.h"
#include "SignalsPanel.h" #include "SignalsPanel.h"
#ifndef DEFAULT_SIGNAL
#define DEFAULT_SIGNAL 16
#endif
}*/ }*/
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
...@@ -176,14 +181,14 @@ double Platform_setCPUValues(Meter* this, int cpu) { ...@@ -176,14 +181,14 @@ double Platform_setCPUValues(Meter* this, int cpu) {
percent = v[0]+v[1]+v[2]+v[3]+v[4]+v[5]+v[6]; percent = v[0]+v[1]+v[2]+v[3]+v[4]+v[5]+v[6];
} else { } else {
percent = v[0]+v[1]+v[2]+v[3]+v[4]; percent = v[0]+v[1]+v[2]+v[3]+v[4];
} }
} else { } else {
v[2] = cpuData->systemAllPeriod / total * 100.0; v[2] = cpuData->systemAllPeriod / total * 100.0;
v[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0; v[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0;
Meter_setItems(this, 4); Meter_setItems(this, 4);
percent = v[0]+v[1]+v[2]+v[3]; percent = v[0]+v[1]+v[2]+v[3];
} }
percent = MIN(100.0, MAX(0.0, percent)); percent = MIN(100.0, MAX(0.0, percent));
if (isnan(percent)) percent = 0.0; if (isnan(percent)) percent = 0.0;
return percent; return percent;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment