"Fossies" - the Fresh Open Source Software Archive

Member "atop-2.8.1/atop.h" (7 Jan 2023, 5780 Bytes) of package /linux/misc/atop-2.8.1.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 "atop.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.7.1_vs_2.8.0.

    1 /*
    2 ** ATOP - System & Process Monitor
    3 **
    4 ** The program 'atop' offers the possibility to view the activity of
    5 ** the system on system-level as well as process-level.
    6 **
    7 ** Include-file describing miscellaneous constants and function-prototypes.
    8 ** ================================================================
    9 ** Author:      Gerlof Langeveld
   10 ** E-mail:      gerlof.langeveld@atoptool.nl
   11 ** Date:        November 1996
   12 ** LINUX-port:  June 2000
   13 **
   14 ** This program is free software; you can redistribute it and/or modify it
   15 ** under the terms of the GNU General Public License as published by the
   16 ** Free Software Foundation; either version 2, or (at your option) any
   17 ** later version.
   18 **
   19 ** This program is distributed in the hope that it will be useful, but
   20 ** WITHOUT ANY WARRANTY; without even the implied warranty of
   21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   22 ** See the GNU General Public License for more details.
   23 */
   24 #define EQ      0
   25 #define SECONDSINDAY    86400
   26 #define RAWNAMESZ   256
   27 
   28 /*
   29 ** memory-size formatting possibilities
   30 */
   31 #define BFORMAT     0
   32 #define KBFORMAT    1
   33 #define KBFORMAT_INT    2
   34 #define MBFORMAT    3
   35 #define MBFORMAT_INT    4
   36 #define GBFORMAT    5
   37 #define GBFORMAT_INT    6
   38 #define TBFORMAT    7
   39 #define TBFORMAT_INT    8
   40 #define PBFORMAT    9
   41 #define PBFORMAT_INT    10
   42 #define OVFORMAT    11
   43 
   44 typedef long long   count_t;
   45 
   46 struct tstat;
   47 struct devtstat;
   48 struct sstat;
   49 struct netpertask;
   50 
   51 /* 
   52 ** miscellaneous flags
   53 */
   54 #define RRBOOT      0x0001
   55 #define RRLAST      0x0002
   56 #define RRNETATOP   0x0004
   57 #define RRNETATOPD  0x0008
   58 #define RRACCTACTIVE    0x0010
   59 #define RRIOSTAT    0x0020
   60 #define RRDOCKSTAT  0x0040
   61 #define RRGPUSTAT   0x0080
   62 #define RRCGRSTAT   0x0100
   63 
   64 struct visualize {
   65     char    (*show_samp)  (time_t, int,
   66                     struct devtstat *, struct sstat *,
   67             int, unsigned int, char);
   68     void    (*show_error) (const char *, ...);
   69     void    (*show_end)   (void);
   70     void    (*show_usage) (void);
   71 };
   72 
   73 /*
   74 ** external values
   75 */
   76 extern struct utsname   utsname;
   77 extern int              utsnodenamelen;
   78 extern time_t       pretime;
   79 extern time_t       curtime;
   80 extern unsigned long    interval;
   81 extern unsigned long    sampcnt;
   82 extern char         screen;
   83 extern int          linelen;
   84 extern char         acctreason;
   85 extern char     deviatonly;
   86 extern char     usecolors;
   87 extern char     threadview;
   88 extern char     calcpss;
   89 extern char     getwchan;
   90 extern char     rawname[];
   91 extern char     rawreadflag;
   92 extern char     rmspaces;
   93 extern time_t       begintime, endtime, cursortime; // epoch or time in day
   94 extern char     flaglist[];
   95 extern struct visualize vis;
   96 
   97 extern int          osrel;
   98 extern int      osvers;
   99 extern int          ossub;
  100 
  101 extern unsigned short   hertz;
  102 extern unsigned int pagesize;
  103 extern unsigned int pidwidth;
  104 extern unsigned int nrgpus;
  105 
  106 extern int      supportflags;
  107 
  108 extern int      cpubadness;
  109 extern int      membadness;
  110 extern int      swpbadness;
  111 extern int      dskbadness;
  112 extern int      netbadness;
  113 extern int      pagbadness;
  114 extern int      almostcrit;
  115 
  116 /*
  117 ** bit-values for supportflags
  118 */
  119 #define ACCTACTIVE  0x00000001
  120 #define IOSTAT      0x00000004
  121 #define NETATOP     0x00000010
  122 #define NETATOPD    0x00000020
  123 #define DOCKSTAT    0x00000040
  124 #define GPUSTAT     0x00000080
  125 #define CGROUPV2    0x00000100
  126 
  127 /*
  128 ** in rawlog file, the four least significant bits 
  129 ** are moved to the per-sample flags and therefor dummy
  130 ** in the support flags of the general header
  131 */
  132 #define RAWLOGNG    (ACCTACTIVE|IOSTAT|NETATOP|NETATOPD)
  133 
  134 /*
  135 ** structure containing the start-addresses of functions for visualization
  136 */
  137 char        generic_samp (time_t, int,
  138                     struct devtstat *, struct sstat *,
  139                     int, unsigned int, char);
  140 void        generic_error(const char *, ...);
  141 void        generic_end  (void);
  142 void        generic_usage(void);
  143 
  144 /*
  145 ** miscellaneous prototypes
  146 */
  147 int     atopsar(int, char *[]);
  148 char        *convtime(time_t, char *);
  149 char        *convdate(time_t, char *);
  150 int         getbranchtime(char *, time_t *);
  151 time_t      normalize_epoch(time_t, long);
  152 
  153 
  154 char        *val2valstr(count_t, char *, int, int, int);
  155 char        *val2memstr(count_t, char *, int, int, int);
  156 char        *val2cpustr(count_t, char *);
  157 char            *val2Hzstr(count_t, char *);
  158 int             val2elapstr(int, char *);
  159 
  160 int     compcpu(const void *, const void *);
  161 int     compdsk(const void *, const void *);
  162 int     compmem(const void *, const void *);
  163 int     compnet(const void *, const void *);
  164 int     compgpu(const void *, const void *);
  165 int     compusr(const void *, const void *);
  166 int     compnam(const void *, const void *);
  167 int     compcon(const void *, const void *);
  168 
  169 int     cpucompar (const void *, const void *);
  170 int     gpucompar (const void *, const void *);
  171 int     diskcompar(const void *, const void *);
  172 int     intfcompar(const void *, const void *);
  173 int     ifbcompar(const void *, const void *);
  174 int     nfsmcompar(const void *, const void *);
  175 int     contcompar(const void *, const void *);
  176 int     memnumacompar(const void *, const void *);
  177 int     cpunumacompar(const void *, const void *);
  178 int     llccompar(const void *, const void *);
  179 
  180 int         rawread(void);
  181 char        rawwrite (time_t, int,
  182                     struct devtstat *, struct sstat *,
  183                     int, unsigned int, char);
  184 
  185 int         numeric(char *);
  186 void        getalarm(int);
  187 unsigned long long  getboot(void);
  188 char        *getstrvers(void);
  189 unsigned short  getnumvers(void);
  190 void        ptrverify(const void *, const char *, ...);
  191 void        mcleanstop(int, const char *, ...);
  192 void        cleanstop(int);
  193 int     getpidwidth(void);
  194 void        prusage(char *);
  195 
  196 int     droprootprivs(void);
  197 void        regainrootprivs(void);
  198 FILE        *fopen_tryroot(const char *, const char *);
  199 
  200 void        netatop_ipopen(void);
  201 void        netatop_probe(void);
  202 void        netatop_signoff(void);
  203 void        netatop_gettask(pid_t, char, struct tstat *);
  204 unsigned int    netatop_exitstore(void);
  205 void        netatop_exiterase(void);
  206 void        netatop_exithash(char);
  207 void        netatop_exitfind(unsigned long, struct tstat *, struct tstat *);
  208 void        set_oom_score_adj(void);
  209 int     run_in_guest(void);