"Fossies" - the Fresh Open Source Software Archive

Member "atop-2.8.1/netatop.h" (7 Jan 2023, 2454 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 "netatop.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.6.0_vs_2.7.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 ** Author:      Gerlof Langeveld
    8 ** E-mail:      gerlof.langeveld@atoptool.nl
    9 ** Date:        September 2002
   10 ** --------------------------------------------------------------------------
   11 ** Copyright (C) 2000-2010 Gerlof Langeveld
   12 **
   13 ** This program is free software; you can redistribute it and/or modify it
   14 ** under the terms of the GNU General Public License as published by the
   15 ** Free Software Foundation; either version 2, or (at your option) any
   16 ** later version.
   17 **
   18 ** This program is distributed in the hope that it will be useful, but
   19 ** WITHOUT ANY WARRANTY; without even the implied warranty of
   20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   21 ** See the GNU General Public License for more details.
   22 **
   23 ** You should have received a copy of the GNU General Public License
   24 ** along with this program; if not, write to the Free Software
   25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   26 ** --------------------------------------------------------------------------
   27 */
   28 
   29 #define COMLEN  16
   30 
   31 struct taskcount {
   32     unsigned long long  tcpsndpacks;
   33     unsigned long long  tcpsndbytes;
   34     unsigned long long  tcprcvpacks;
   35     unsigned long long  tcprcvbytes;
   36 
   37     unsigned long long  udpsndpacks;
   38     unsigned long long  udpsndbytes;
   39     unsigned long long  udprcvpacks;
   40     unsigned long long  udprcvbytes;
   41 
   42     /* space for future extensions */
   43 };
   44 
   45 struct netpertask {
   46     pid_t           id; // tgid or tid (depending on command)
   47     unsigned long       btime;
   48     char            command[COMLEN];
   49 
   50     struct taskcount    tc;
   51 };
   52 
   53 
   54 /*
   55 ** getsocktop commands
   56 */
   57 #define NETATOP_BASE_CTL    15661
   58 
   59 // just probe if the netatop module is active
   60 #define NETATOP_PROBE       (NETATOP_BASE_CTL)
   61 
   62 // force garbage collection to make finished processes available
   63 #define NETATOP_FORCE_GC    (NETATOP_BASE_CTL+1)
   64 
   65 // wait until all finished processes are read (blocks until done)
   66 #define NETATOP_EMPTY_EXIT  (NETATOP_BASE_CTL+2)
   67 
   68 // get info for finished process (blocks until available)
   69 #define NETATOP_GETCNT_EXIT (NETATOP_BASE_CTL+3)
   70 
   71 // get counters for thread group (i.e. process):  input is 'id' (pid)
   72 #define NETATOP_GETCNT_TGID (NETATOP_BASE_CTL+4)
   73 
   74 // get counters for thread:  input is 'id' (tid)
   75 #define NETATOP_GETCNT_PID  (NETATOP_BASE_CTL+5)