mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 20:24:35 +03:00
Support ZFS ARC stats on FreeBSD
New meter displays same ARC stats as FreeBSD top(1). Can be extended to other platforms that support ZFS. Pulling kstat.zfs.misc.arcstats.c_max as the meter total, so the meter has a meaningful value to work up to. The Text meter displays, first, the maximum ARC size (Meter.total), then second, the total ARC used, using the difference between Meter.maxItems and Meter.curItems to "hide" the used value from the Bar and Graph drawing functions by using an index in Meter.values[] that is beyond curItems - 1, but less than maxItems - 1.
This commit is contained in:
@ -15,6 +15,7 @@ in the source distribution for its full text.
|
||||
#include "UptimeMeter.h"
|
||||
#include "ClockMeter.h"
|
||||
#include "HostnameMeter.h"
|
||||
#include "zfs/ZfsArcMeter.h"
|
||||
#include "FreeBSDProcess.h"
|
||||
#include "FreeBSDProcessList.h"
|
||||
|
||||
@ -104,6 +105,7 @@ MeterClass* Platform_meterTypes[] = {
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&BlankMeter_class,
|
||||
&ZfsArcMeter_class,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -197,6 +199,23 @@ void Platform_setSwapValues(Meter* this) {
|
||||
this->values[0] = pl->usedSwap;
|
||||
}
|
||||
|
||||
void Platform_setZfsArcValues(Meter* this) {
|
||||
FreeBSDProcessList* fpl = (FreeBSDProcessList*) this->pl;
|
||||
|
||||
this->total = fpl->zfsArcMax;
|
||||
this->values[0] = fpl->zfsArcMFU;
|
||||
this->values[1] = fpl->zfsArcMRU;
|
||||
this->values[2] = fpl->zfsArcAnon;
|
||||
this->values[3] = fpl->zfsArcHeader;
|
||||
this->values[4] = fpl->zfsArcOther;
|
||||
|
||||
// "Hide" the last value so it can
|
||||
// only be accessed by index and is not
|
||||
// displayed by the Bar or Graph style
|
||||
Meter_setItems(this, 5);
|
||||
this->values[5] = fpl->memZfsArc;
|
||||
}
|
||||
|
||||
void Platform_setTasksValues(Meter* this) {
|
||||
// TODO
|
||||
}
|
||||
|
Reference in New Issue
Block a user