mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-25 15:25:45 +00:00
9197adf57e
The current OpenBSD-specific CPU usage code is broken. The `cpu` parameter of `Platform_setCPUValues` is an integer in the interval [0, cpuCount], not [0, cpuCount-1]: Actual CPUs are numbered from 1, the “zero” CPU is a “virtual” one which represents the average of actual CPUs (I guess it’s inherited from Linux’s `/proc/stats`). This off-by-one error leads to random crashes. Moreover, the displayed CPU usage is more detailed with system, user and nice times. I made the OpenBSD CPU code more similar to the Linux CPU code, removing a few old bits from OpenBSD’s top(1). I think it will be easier to understand, maintain and evolve. I’d love some feedback from experienced OpenBSD people.
59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
/* Do not edit this file. It was automatically generated. */
|
|
|
|
#ifndef HEADER_Platform
|
|
#define HEADER_Platform
|
|
/*
|
|
htop - openbsd/Platform.h
|
|
(C) 2014 Hisham H. Muhammad
|
|
(C) 2015 Michael McConville
|
|
Released under the GNU GPL, see the COPYING file
|
|
in the source distribution for its full text.
|
|
*/
|
|
|
|
#include "Action.h"
|
|
#include "BatteryMeter.h"
|
|
#include "SignalsPanel.h"
|
|
|
|
extern ProcessFieldData Process_fields[];
|
|
|
|
|
|
extern ProcessField Platform_defaultFields[];
|
|
|
|
extern int Platform_numberOfFields;
|
|
|
|
/*
|
|
* See /usr/include/sys/signal.h
|
|
*/
|
|
extern const SignalItem Platform_signals[];
|
|
|
|
extern const unsigned int Platform_numberOfSignals;
|
|
|
|
void Platform_setBindings(Htop_Action* keys);
|
|
|
|
extern MeterClass* Platform_meterTypes[];
|
|
|
|
// preserved from FreeBSD port
|
|
int Platform_getUptime();
|
|
|
|
void Platform_getLoadAverage(double* one, double* five, double* fifteen);
|
|
|
|
int Platform_getMaxPid();
|
|
|
|
double Platform_setCPUValues(Meter* this, int cpu);
|
|
|
|
void Platform_setMemoryValues(Meter* this);
|
|
|
|
/*
|
|
* Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
|
|
* All rights reserved.
|
|
*
|
|
* Taken almost directly from OpenBSD's top(1)
|
|
*/
|
|
void Platform_setSwapValues(Meter* this);
|
|
|
|
void Platform_setTasksValues(Meter* this);
|
|
|
|
char* Platform_getProcessEnv(pid_t pid);
|
|
|
|
#endif
|