"Fossies" - the Fresh Open Source Software Archive

Member "xosview-1.23/bsd/cpumeter.h" (11 Jul 2020, 1167 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 //  Copyright (c) 1994, 1995 by Mike Romberg ( romberg@fsl.noaa.gov )
    3 //
    4 //  NetBSD port:
    5 //  Copyright (c) 1995, 1996, 1997-2002 by Brian Grayson (bgrayson@netbsd.org)
    6 //
    7 //  This file was written by Brian Grayson for the NetBSD and xosview
    8 //    projects.
    9 //  This file may be distributed under terms of the GPL or of the BSD
   10 //    license, whichever you choose.  The full license notices are
   11 //    contained in the files COPYING.GPL and COPYING.BSD, which you
   12 //    should have received.  If not, contact one of the xosview
   13 //    authors for a copy.
   14 //
   15 
   16 #ifndef _CPUMETER_H_
   17 #define _CPUMETER_H_
   18 
   19 #include "fieldmetergraph.h"
   20 #include "xosview.h"
   21 #include "defines.h"
   22 
   23 // for CPUSTATES
   24 #if defined(XOSVIEW_NETBSD) || defined(XOSVIEW_OPENBSD)
   25 #include <sys/sched.h>
   26 #else
   27 #include <sys/resource.h>
   28 #endif
   29 
   30 
   31 class CPUMeter : public FieldMeterGraph {
   32 public:
   33     CPUMeter( XOSView *parent, unsigned int nbr );
   34     ~CPUMeter( void );
   35 
   36     const char *name( void ) const { return "CPUMeter"; }
   37     void checkevent( void );
   38     void checkResources( void );
   39 
   40 protected:
   41     void getcputime( void );
   42 
   43 private:
   44     uint64_t cputime_[2][CPUSTATES];
   45     unsigned int cpuindex_, nbr_;
   46 };
   47 
   48 
   49 #endif