15 gettimeofday (&tv, NULL);
16 return (tv.tv_sec + tv.tv_usec / 1000000.0);
22 static char buffer[1024];
23 static double last = 0.0;
32 lseek (fd, 0, SEEK_SET);
34 n = read (fd, buffer, sizeof (buffer));
37 fprintf (stderr, "Can't read statfile\n");
42 n = sscanf (buffer, "%Ld %ld %ld %ld", &bytes, &packets, &errors, &depth);
46 fprintf (stderr, "Can't parse statfile\n");
51 printf ("%Ld bytes, %ld packets (sz %Ld) %ld errors",
52 bytes, packets, (long long)((packets == 0) ? 0LL : bytes/packets), errors);
57 printf ("%9Ld (%7.2fMb/s), %7ld packets (sz %5Ld, %5ld/s) %ld errors (%ld/s)",
58 bytes, ((double)bytes)/((1<<20) * t),
59 packets, (long long)((packets == 0) ? 0LL : bytes/packets), (long)(packets/t),
60 errors, (long)(errors/t));
64 printf (" (%ld)\n", depth);
70 lseek (fd, 0, SEEK_SET);
75 int main (int argc, char **argv)
81 interval = atoi (argv[1]);
83 fd = open ("/proc/sys/portals/router", O_RDWR);
86 fprintf (stderr, "Can't open stat: %s\n", strerror (errno));