"Fossies" - the Fresh Open Source Software Archive

Member "xosview-1.23/irix65/cpumeter.h" (11 Jul 2020, 808 Bytes) of package /linux/misc/xosview-1.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "cpumeter.h" see the Fossies "Dox" file reference documentation.

    1 //  
    2 //  Initial port performed by Stefan Eilemann (eilemann@gmail.com)
    3 //
    4 #ifndef _CPUMETER_H_
    5 #define _CPUMETER_H_
    6 
    7 #include "fieldmetergraph.h"
    8 
    9 #include <sys/types.h>
   10 #include <sys/sysmp.h>
   11 #include <sys/sysinfo.h>
   12     
   13 #define USED_CPU_STATES (CPU_STATES-1) // SXBRK + IDLE merged
   14 
   15 class CPUMeter : public FieldMeterGraph {
   16  public:
   17     CPUMeter(XOSView *parent, const int cpuid = 0);
   18     ~CPUMeter(void);
   19 
   20     const char *name(void) const { return "CPUMeter"; }
   21     void checkevent(void);
   22 
   23     void checkResources(void);
   24 
   25     static int nCPUs();
   26     static const char *cpuStr(int num);
   27 
   28  protected:
   29     time_t cputime_[2][USED_CPU_STATES];
   30     int cpuindex_;
   31 
   32     void getcputime(void);
   33     const char *toUpper(const char *str);
   34 
   35  private:
   36     struct sysinfo   tsp;
   37     int              sinfosz;
   38     int              cpuid_;
   39 };
   40 
   41 #endif