|
|
|
|
@ -6,30 +6,38 @@ Released under the GNU GPLv2, see the COPYING file |
|
|
|
|
in the source distribution for its full text. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include "config.h" // IWYU pragma: keep |
|
|
|
|
|
|
|
|
|
#include "Platform.h" |
|
|
|
|
#include "Macros.h" |
|
|
|
|
#include "CPUMeter.h" |
|
|
|
|
#include "MemoryMeter.h" |
|
|
|
|
#include "SwapMeter.h" |
|
|
|
|
#include "TasksMeter.h" |
|
|
|
|
#include "LoadAverageMeter.h" |
|
|
|
|
|
|
|
|
|
#include <math.h> |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
|
|
#include <CoreFoundation/CoreFoundation.h> |
|
|
|
|
#include <CoreFoundation/CFString.h> |
|
|
|
|
#include <IOKit/ps/IOPowerSources.h> |
|
|
|
|
#include <IOKit/ps/IOPSKeys.h> |
|
|
|
|
|
|
|
|
|
#include "ClockMeter.h" |
|
|
|
|
#include "CPUMeter.h" |
|
|
|
|
#include "DarwinProcessList.h" |
|
|
|
|
#include "DateMeter.h" |
|
|
|
|
#include "DateTimeMeter.h" |
|
|
|
|
#include "HostnameMeter.h" |
|
|
|
|
#include "LoadAverageMeter.h" |
|
|
|
|
#include "Macros.h" |
|
|
|
|
#include "MemoryMeter.h" |
|
|
|
|
#include "ProcessLocksScreen.h" |
|
|
|
|
#include "SwapMeter.h" |
|
|
|
|
#include "TasksMeter.h" |
|
|
|
|
#include "UptimeMeter.h" |
|
|
|
|
#include "zfs/ZfsArcMeter.h" |
|
|
|
|
#include "zfs/ZfsCompressedArcMeter.h" |
|
|
|
|
#include "DarwinProcessList.h" |
|
|
|
|
|
|
|
|
|
#include <math.h> |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
#ifdef HAVE_MACH_MACH_TIME_H |
|
|
|
|
#include <mach/mach_time.h> |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#include <CoreFoundation/CoreFoundation.h> |
|
|
|
|
#include <CoreFoundation/CFString.h> |
|
|
|
|
#include <IOKit/ps/IOPowerSources.h> |
|
|
|
|
#include <IOKit/ps/IOPSKeys.h> |
|
|
|
|
|
|
|
|
|
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_VIRT, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; |
|
|
|
|
|
|
|
|
|
@ -104,8 +112,18 @@ const MeterClass* const Platform_meterTypes[] = { |
|
|
|
|
|
|
|
|
|
int Platform_numberOfFields = LAST_PROCESSFIELD; |
|
|
|
|
|
|
|
|
|
double Platform_timebaseToNS = 1.0; |
|
|
|
|
|
|
|
|
|
void Platform_init(void) { |
|
|
|
|
/* no platform-specific setup needed */ |
|
|
|
|
// Check if we can determine the timebase used on this system.
|
|
|
|
|
// If the API is unavailable assume we get our timebase in nanoseconds.
|
|
|
|
|
#ifdef HAVE_MACH_TIMEBASE_INFO |
|
|
|
|
mach_timebase_info_data_t info; |
|
|
|
|
mach_timebase_info(&info); |
|
|
|
|
Platform_timebaseToNS = (double)info.numer / (double)info.denom; |
|
|
|
|
#else |
|
|
|
|
Platform_timebaseToNS = 1.0; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Platform_done(void) { |
|
|
|
|
|