diff -Nru hot-babe-0.2.2/hot-babe.c hot-babe-0.2.2.fink/hot-babe.c --- hot-babe-0.2.2/hot-babe.c Mon Dec 6 07:59:38 2004 +++ hot-babe-0.2.2.fink/hot-babe.c Fri May 27 15:43:33 2005 @@ -28,6 +28,10 @@ #include #endif #endif +#ifdef __APPLE__ +#include +#include +#endif /* x11 includes */ #include @@ -99,6 +103,13 @@ long cp_time[CPUSTATES]; size_t len = sizeof(cp_time); #endif +#ifdef __APPLE__ + unsigned long load, total, oload, ototal; + unsigned long ab, ac, ad, ae; + static mach_port_t port = NULL; + mach_msg_type_number_t count = HOST_CPU_LOAD_INFO_COUNT; + host_cpu_load_info_data_t aa; +#endif #ifdef __linux__ stat = fopen("/proc/stat", "r"); @@ -113,6 +124,16 @@ ac = cp_time[CP_NICE]; ad = cp_time[CP_SYS]; ae = cp_time[CP_IDLE]; +#endif +#ifdef __APPLE__ + if (port == NULL) + port = mach_host_self(); + if (host_statistics(port, HOST_CPU_LOAD_INFO, (host_info_t)&aa, &count) != KERN_SUCCESS) + (void)fprintf(stderr, "Cannot get HOST_CPU_LOAD_INFO"); + ab = aa.cpu_ticks[CPU_STATE_USER]; + ac = aa.cpu_ticks[CPU_STATE_NICE]; + ad = aa.cpu_ticks[CPU_STATE_SYSTEM]; + ae = aa.cpu_ticks[CPU_STATE_IDLE]; #endif