htop/unsupported/Platform.c

149 lines
2.9 KiB
C
Raw Normal View History

/*
htop - unsupported/Platform.c
(C) 2014 Hisham H. Muhammad
2015-07-12 16:26:33 +00:00
(C) 2015 David C. Hunt
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
2021-01-28 17:19:38 +00:00
#include "config.h" // IWYU pragma: keep
#include "Platform.h"
2021-01-28 17:19:38 +00:00
#include <math.h>
#include "CPUMeter.h"
#include "ClockMeter.h"
#include "DateMeter.h"
#include "DateTimeMeter.h"
#include "HostnameMeter.h"
2021-01-28 17:19:38 +00:00
#include "LoadAverageMeter.h"
#include "Macros.h"
#include "MemoryMeter.h"
#include "SwapMeter.h"
#include "SysArchMeter.h"
2021-01-28 17:19:38 +00:00
#include "TasksMeter.h"
2014-11-27 21:41:14 +00:00
#include "UptimeMeter.h"
const SignalItem Platform_signals[] = {
{ .name = " 0 Cancel", .number = 0 },
};
2020-10-03 20:00:27 +00:00
const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
2020-12-19 17:10:03 +00:00
const ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_VIRT, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
2015-07-12 16:26:33 +00:00
2020-10-05 11:19:50 +00:00
const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class,
&ClockMeter_class,
&DateMeter_class,
&DateTimeMeter_class,
&LoadAverageMeter_class,
&LoadMeter_class,
&MemoryMeter_class,
&SwapMeter_class,
&TasksMeter_class,
&BatteryMeter_class,
&HostnameMeter_class,
&SysArchMeter_class,
2014-11-27 21:41:14 +00:00
&UptimeMeter_class,
&AllCPUsMeter_class,
&AllCPUs2Meter_class,
&AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class,
&RightCPUsMeter_class,
&LeftCPUs2Meter_class,
&RightCPUs2Meter_class,
&LeftCPUs4Meter_class,
&RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&BlankMeter_class,
NULL
};
void Platform_init(void) {
/* no platform-specific setup needed */
}
void Platform_done(void) {
/* no platform-specific cleanup needed */
}
void Platform_setBindings(Htop_Action* keys) {
/* no platform-specific key bindings */
(void) keys;
}
2014-11-27 21:41:14 +00:00
int Platform_getUptime() {
2015-07-12 16:26:33 +00:00
return 0;
2014-11-27 21:41:14 +00:00
}
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
*one = 0;
*five = 0;
*fifteen = 0;
}
int Platform_getMaxPid() {
2015-07-12 16:26:33 +00:00
return 1;
}
double Platform_setCPUValues(Meter* this, int cpu) {
(void) cpu;
double* v = this->values;
v[CPU_METER_FREQUENCY] = NAN;
v[CPU_METER_TEMPERATURE] = NAN;
2021-01-28 17:19:38 +00:00
this->curItems = 1;
return 0.0;
2015-07-12 16:26:33 +00:00
}
void Platform_setMemoryValues(Meter* this) {
(void) this;
2015-07-12 16:26:33 +00:00
}
void Platform_setSwapValues(Meter* this) {
(void) this;
2015-07-12 16:26:33 +00:00
}
bool Process_isThread(const Process* this) {
(void) this;
2015-07-12 16:26:33 +00:00
return false;
}
char* Platform_getProcessEnv(pid_t pid) {
(void) pid;
return NULL;
}
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
}
bool Platform_getDiskIO(DiskIOData* data) {
(void)data;
return false;
}
2020-10-08 14:34:54 +00:00
bool Platform_getNetworkIO(NetworkIOData* data) {
(void)data;
return false;
2020-10-08 14:34:54 +00:00
}
void Platform_getBattery(double* percent, ACPresence* isOnAC) {
*percent = NAN;
*isOnAC = AC_ERROR;
}