|
|
|
@ -24,9 +24,7 @@
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __osf__
|
|
|
|
|
#include <sys/table.h>
|
|
|
|
|
#elif defined(USE_SOLARIS)
|
|
|
|
|
#if defined(USE_SOLARIS)
|
|
|
|
|
#include <kstat.h>
|
|
|
|
|
#include <sys/sysinfo.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
@ -42,7 +40,7 @@
|
|
|
|
|
|
|
|
|
|
// -- global definitions -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#if defined(__osf__) || defined(USE_SOLARIS)
|
|
|
|
|
#if defined(USE_SOLARIS)
|
|
|
|
|
extern "C" int getpagesize(); // argh, have to define prototype!
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -130,7 +128,7 @@ KSample::KSample(KTimeMon *t, bool a, unsigned p, unsigned s, unsigned c) :
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(USE_SOLARIS) || defined(__osf__)
|
|
|
|
|
#if defined(USE_SOLARIS)
|
|
|
|
|
pagesPerMB = (1024*1024) / getpagesize();
|
|
|
|
|
if (pagesPerMB == 0) pagesPerMB = 1; // paranoia sanity check
|
|
|
|
|
#endif
|
|
|
|
@ -261,41 +259,6 @@ void KSample::readSample()
|
|
|
|
|
}
|
|
|
|
|
sample.cpus = l;
|
|
|
|
|
|
|
|
|
|
#elif defined(__osf__) // in OSF/2, we can use table()
|
|
|
|
|
|
|
|
|
|
TQString msg = i18n("Unable to obtain system information.\n"
|
|
|
|
|
"The table(2) system call returned an error "
|
|
|
|
|
"for table %1.\n"
|
|
|
|
|
"Please contact the maintainer at mueller@kde.org "
|
|
|
|
|
"who will try to figure out what went wrong.");
|
|
|
|
|
|
|
|
|
|
struct tbl_sysinfo sysinfo;
|
|
|
|
|
if (table(TBL_SYSINFO, 0, &sysinfo, 1, sizeof(sysinfo)) != 1)
|
|
|
|
|
fatal(msg.arg("TBL_SYSINFO"));
|
|
|
|
|
|
|
|
|
|
sample.user = sysinfo.si_user;
|
|
|
|
|
sample.nice = sysinfo.si_nice;
|
|
|
|
|
sample.kernel = sysinfo.si_sys;
|
|
|
|
|
sample.iowait = sysinfo.wait;
|
|
|
|
|
sample.idle = sysinfo.si_idle;
|
|
|
|
|
|
|
|
|
|
struct tbl_vmstats vmstats;
|
|
|
|
|
if (table(TBL_VMSTATS, 0, &vmstats, 1, sizeof(vmstats)) != 1)
|
|
|
|
|
fatal(msg.arg("TBL_VMSTATS"));
|
|
|
|
|
|
|
|
|
|
sample.mtotal = vmstats.free_count + vmstats.active_count +
|
|
|
|
|
vmstats.inactive_count + vmstats.wire_count;
|
|
|
|
|
sample.free = vmstats.free_count;
|
|
|
|
|
sample.buffers = vmstats.inactive_count; // pages not used for some time
|
|
|
|
|
sample.cached = vmstats.wire_count; // kernel/driver memory
|
|
|
|
|
|
|
|
|
|
struct tbl_swapinfo swapinfo;
|
|
|
|
|
if (table(TBL_SWAPINFO, -1, &swapinfo, 1, sizeof(swapinfo)) != 1)
|
|
|
|
|
fatal(msg.arg("TBL_SWAPINFO"));
|
|
|
|
|
|
|
|
|
|
sample.stotal = swapinfo.size;
|
|
|
|
|
sample.sfree = swapinfo.free;
|
|
|
|
|
|
|
|
|
|
#elif defined(USE_SOLARIS)
|
|
|
|
|
kstat_t *ksp;
|
|
|
|
|
|
|
|
|
@ -441,7 +404,7 @@ inline void KSample::makeMBytes(unsigned long &v)
|
|
|
|
|
{
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
v /= 1024; // can it be simpler ;-)
|
|
|
|
|
#elif defined (__osf__) || defined(USE_SOLARIS)
|
|
|
|
|
#elif defined(USE_SOLARIS)
|
|
|
|
|
v /= pagesPerMB;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|