"Fossies" - the Fresh Open Source Software Archive

Member "atop-2.8.1/acctproc.h" (7 Jan 2023, 5471 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 "acctproc.h" see the Fossies "Dox" file reference documentation.

    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 for process-accounting functions.
    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 int         acctswon(void);
   25 void        acctswoff(void);
   26 unsigned long   acctprocnt(void);
   27 unsigned long   acctphotoproc(struct tstat *, int);
   28 void        acctrepos(unsigned int);
   29 
   30 /*
   31 ** maximum number of records to be read from process accounting file
   32 ** for one sample, to avoid that atop explodes and introduces OOM killing ....
   33 **
   34 ** the maximum is based on a limit of 50 MiB extra memory (approx. 70000 procs)
   35 */
   36 #define MAXACCTPROCS    (50*1024*1024/sizeof(struct tstat))
   37 
   38 /*
   39 ** preferred maximum size of process accounting file (200 MiB)
   40 */
   41 #define ACCTMAXFILESZ   (200*1024*1024)
   42 
   43 /*
   44 ** alternative layout of accounting record if kernel-patch
   45 ** has been installed
   46 */
   47 #include <linux/types.h>
   48 typedef __u16   comp_t;
   49 typedef __u32   comp2_t;
   50 #define ACCT_COMM   16
   51 
   52 struct acct_atop
   53 {
   54     char        ac_flag;        /* Flags */
   55     char        ac_version;     /* Always set to ACCT_VERSION */
   56     __u32       ac_pid;         /* Process ID */
   57     __u32       ac_ppid;        /* Parent Process ID */
   58     __u16       ac_uid16;       /* LSB of Real User ID */
   59     __u16       ac_gid16;       /* LSB of Real Group ID */
   60     __u16       ac_tty;         /* Control Terminal */
   61     __u32       ac_btime;       /* Process Creation Time */
   62     comp_t      ac_utime;       /* User Time */
   63     comp_t      ac_stime;       /* System Time */
   64     comp_t      ac_etime;       /* Elapsed Time */
   65     comp_t      ac_mem;         /* Virtual  Memory */
   66     comp_t      ac_rss;         /* Resident Memory */
   67     comp_t      ac_io;          /* Chars Transferred */
   68     comp_t      ac_rw;          /* Blocks Read or Written */
   69     comp_t      ac_bread;       /* Blocks Read */
   70     comp_t      ac_bwrite;      /* Blocks Written */
   71     comp2_t     ac_dskrsz;      /* Cum. blocks read */
   72     comp2_t     ac_dskwsz;      /* Cum. blocks written */
   73     comp_t      ac_tcpsnd;      /* TCP send requests */
   74     comp_t      ac_tcprcv;      /* TCP recv requests */
   75     comp2_t     ac_tcpssz;      /* TCP cum. length   */
   76     comp2_t     ac_tcprsz;      /* TCP cum. length   */
   77     comp_t      ac_udpsnd;      /* UDP send requests */
   78     comp_t      ac_udprcv;      /* UDP recv requests */
   79     comp2_t     ac_udpssz;      /* UDP cum. length   */
   80     comp2_t     ac_udprsz;      /* UDP cum. length   */
   81     comp_t      ac_rawsnd;      /* RAW send requests */
   82     comp_t      ac_rawrcv;      /* RAW recv requests */
   83     comp_t      ac_minflt;      /* Minor Pagefaults */
   84     comp_t      ac_majflt;      /* Major Pagefaults */
   85     comp_t      ac_swaps;       /* Number of Swaps */
   86 /* m68k had no padding here. */
   87 #if !defined(CONFIG_M68K) || !defined(__KERNEL__)
   88     __u16       ac_ahz;         /* AHZ */
   89 #endif
   90     __u32       ac_exitcode;        /* Exitcode */
   91     char        ac_comm[ACCT_COMM + 1]; /* Command Name */
   92     __u8        ac_etime_hi;        /* Elapsed Time MSB */
   93     __u16       ac_etime_lo;        /* Elapsed Time LSB */
   94     __u32       ac_uid;         /* Real User ID */
   95     __u32       ac_gid;         /* Real Group ID */
   96 };
   97 
   98 /*
   99 ** default layout of accounting record
  100 ** (copied from /usr/src/linux/include/linux/acct.h)
  101 */
  102 
  103 struct acct
  104 {
  105     char        ac_flag;        /* Flags */
  106     char        ac_version;     /* Always set to ACCT_VERSION */
  107     /* for binary compatibility back until 2.0 */
  108     __u16       ac_uid16;       /* LSB of Real User ID */
  109     __u16       ac_gid16;       /* LSB of Real Group ID */
  110     __u16       ac_tty;         /* Control Terminal */
  111     __u32       ac_btime;       /* Process Creation Time */
  112     comp_t      ac_utime;       /* User Time */
  113     comp_t      ac_stime;       /* System Time */
  114     comp_t      ac_etime;       /* Elapsed Time */
  115     comp_t      ac_mem;         /* Average Memory Usage */
  116     comp_t      ac_io;          /* Chars Transferred */
  117     comp_t      ac_rw;          /* Blocks Read or Written */
  118     comp_t      ac_minflt;      /* Minor Pagefaults */
  119     comp_t      ac_majflt;      /* Major Pagefaults */
  120     comp_t      ac_swaps;       /* Number of Swaps */
  121 /* m68k had no padding here. */
  122 #if !defined(CONFIG_M68K) || !defined(__KERNEL__)
  123     __u16       ac_ahz;         /* AHZ */
  124 #endif
  125     __u32       ac_exitcode;        /* Exitcode */
  126     char        ac_comm[ACCT_COMM + 1]; /* Command Name */
  127     __u8        ac_etime_hi;        /* Elapsed Time MSB */
  128     __u16       ac_etime_lo;        /* Elapsed Time LSB */
  129     __u32       ac_uid;         /* Real User ID */
  130     __u32       ac_gid;         /* Real Group ID */
  131 };
  132 
  133 struct acct_v3
  134 {
  135     char        ac_flag;        /* Flags */
  136     char        ac_version;     /* Always set to ACCT_VERSION */
  137     __u16       ac_tty;         /* Control Terminal */
  138     __u32       ac_exitcode;        /* Exitcode */
  139     __u32       ac_uid;         /* Real User ID */
  140     __u32       ac_gid;         /* Real Group ID */
  141     __u32       ac_pid;         /* Process ID */
  142     __u32       ac_ppid;        /* Parent Process ID */
  143     __u32       ac_btime;       /* Process Creation Time */
  144 #ifdef __KERNEL__
  145     __u32       ac_etime;       /* Elapsed Time */
  146 #else
  147     float       ac_etime;       /* Elapsed Time */
  148 #endif
  149     comp_t      ac_utime;       /* User Time */
  150     comp_t      ac_stime;       /* System Time */
  151     comp_t      ac_mem;         /* Average Memory Usage */
  152     comp_t      ac_io;          /* Chars Transferred */
  153     comp_t      ac_rw;          /* Blocks Read or Written */
  154     comp_t      ac_minflt;      /* Minor Pagefaults */
  155     comp_t      ac_majflt;      /* Major Pagefaults */
  156     comp_t      ac_swaps;       /* Number of Swaps */
  157     char        ac_comm[ACCT_COMM]; /* Command Name */
  158 };