mirror of https://github.com/xzeldon/htop.git
148 lines
3.1 KiB
C
148 lines
3.1 KiB
C
/*
|
|
htop - unsupported/Platform.c
|
|
(C) 2014 Hisham H. Muhammad
|
|
(C) 2015 David C. Hunt
|
|
Released under the GNU GPLv2, see the COPYING file
|
|
in the source distribution for its full text.
|
|
*/
|
|
|
|
#include <math.h>
|
|
|
|
#include "Platform.h"
|
|
#include "Macros.h"
|
|
#include "CPUMeter.h"
|
|
#include "MemoryMeter.h"
|
|
#include "SwapMeter.h"
|
|
#include "TasksMeter.h"
|
|
#include "LoadAverageMeter.h"
|
|
#include "ClockMeter.h"
|
|
#include "DateMeter.h"
|
|
#include "DateTimeMeter.h"
|
|
#include "HostnameMeter.h"
|
|
#include "UptimeMeter.h"
|
|
|
|
|
|
const SignalItem Platform_signals[] = {
|
|
{ .name = " 0 Cancel", .number = 0 },
|
|
};
|
|
|
|
const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
|
|
|
|
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_VIRT, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
|
|
|
|
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,
|
|
&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;
|
|
}
|
|
|
|
int Platform_getUptime() {
|
|
return 0;
|
|
}
|
|
|
|
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
|
*one = 0;
|
|
*five = 0;
|
|
*fifteen = 0;
|
|
}
|
|
|
|
int Platform_getMaxPid() {
|
|
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;
|
|
|
|
return 0.0;
|
|
}
|
|
|
|
void Platform_setMemoryValues(Meter* this) {
|
|
(void) this;
|
|
}
|
|
|
|
void Platform_setSwapValues(Meter* this) {
|
|
(void) this;
|
|
}
|
|
|
|
bool Process_isThread(const Process* this) {
|
|
(void) this;
|
|
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;
|
|
}
|
|
|
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
|
unsigned long int* packetsReceived,
|
|
unsigned long int* bytesTransmitted,
|
|
unsigned long int* packetsTransmitted) {
|
|
*bytesReceived = 0;
|
|
*packetsReceived = 0;
|
|
*bytesTransmitted = 0;
|
|
*packetsTransmitted = 0;
|
|
return false;
|
|
}
|
|
|
|
void Platform_getBattery(double* percent, ACPresence* isOnAC) {
|
|
*percent = NAN;
|
|
*isOnAC = AC_ERROR;
|
|
}
|