Source Code (Use browser search to find items of interest.)
Class Index
ktimemon'KSample (./kdeutils/ktimemon/sample.h:42)
class KSample {
public:
// -- Sample declaration -----------------------------------------------
struct Sample {
unsigned long cputotal;
unsigned long user, nice, kernel, idle;
int cpus;
unsigned long smptotal[MAX_CPU], smpbusy[MAX_CPU];
unsigned long pin, pout, swin, swout, cswitches;
unsigned long mtotal, free, buffers, cached, used;
unsigned long stotal, sused, sfree;
void fill(unsigned scale); // fill sample with some fake values
};
KSample(KTimeMon *timemon, bool autoScale, unsigned pageScale,
unsigned swapScale, unsigned ctxScale);
virtual ~KSample();
void setScaling(bool autoScale, unsigned pageScale,
unsigned swapScale, unsigned ctxScale);
Sample getSample(unsigned scale); // returns the current sample
Sample getRawSample(); // returns unscaled sample
void updateSample(); // updates the internally stored sample
private:
void readSample(); // reads a new sample from /proc
inline unsigned long doScale(unsigned long value, unsigned scale1,
unsigned long scale2);
// converts pages to MB
inline void makeMBytes(unsigned long &pages);
// outputs message to dialog box and
// terminates program
inline void fatal(const char *msg, ...);
inline void nonfatal(const char *msg, ...);
KTimeMon *timemon;
#ifdef linux
void parseMtab(char *dest); // parse /etc/mtab
char proc[256]; // be sure to change sscanf as well
int memFD, statFD;
#elif defined(__sun__)
struct kstat_ctl *kc;
bool warned;
#endif
#if defined(__sun__) || defined(__osf__)
unsigned long pagesPerMB;
#endif
Sample sample, oldSample;
unsigned pageScale, swapScale, cxScale;
bool autoscale;
};