text: Provided by: libstatgrab-dev_0.17-0ubuntu1_amd64
  NAME
  sg_get_network_io_stats, sg_get_network_io_stats_diff - get network statistics
  SYNOPSIS
  #include <statgrab.h> sg_network_io_stats *sg_get_network_io_stats(int *entries); sg_network_io_stats *sg_get_network_io_stats_diff(int *entries);
  DESCRIPTION
  Both calls take a pointer to an int, entries, which is filled with the number of network interfaces the machine has. This is needed to know how many sg_network_io_stats structures have been returned. A pointer is returned to the first sg_network_io_stats. sg_get_network_io_stats returns the network traffic_network_io_stats also returns the number of packets sent and received, and the number of errors that have occured. It also makes the number of collisions available. sg_get_network_io_stats_diff is the same as sg_get_network_io_stats except it will return the difference since the last call. So, for instance a call to sg_get_network_io_stats_diff is made, and called again 5 seconds later. Over that time, 20 bytes of traffic was transmitted and 10 bytes received. Tx will store 20, rx will store 10 and systime will store 5. This function copes with wrap arounds by the O/S so should be seemless to use.
  RETURN VALUES
  All network statistics return a pointer to a structure of type sg_network_io_stats. typedef struct{ char *interface_name; long long tx; long long rx; long long ipackets; long long opackets; long long ierrors; long long oerrors; long long collisions; time_t systime; }sg_network_io_stats; interface_name The name known to the operating system. (eg. on linux it might be eth time period over which tx and rx were transferred.
  BUGS
  On the very first call sg_get_network_io_stats_diff will return the same as sg_get_network_io_stats. After the first call it will always return the difference. On operating system that hold only 32bits of data there is a problem if the values wrap twice. For example, on Solaris 7 if 9GB is transferred and the operating system wraps at 4GB, the sg_get_network_io_stats_diff function will return 5GB.
  SEE ALSO
  statgrab(3)
  WEBSITE