#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/stat.h>






static void
init_plot(void)
{
    printf("set term x11\n");
    printf("set title \"Throughput\"\n");
    printf("set xlabel \"Size/words\"\n");
    printf("set ylabel \"Byte/s\"\n");
    printf("plot \"-\" with points\n");
    printf("0 0\n1 1\ne\n\n");
}



/* ****************************************************************************** */

int main(int argc, char* argv)
{
int i, n ;
     init_plot(); 
n=0 ;
do {
     sleep(1) ;

     printf("set multiplot\n"); 
     printf("plot \"temp.txt\" with line 1\n");
     printf("replot \"temp1.txt\" with line 2\n");
     printf("set nomultiplot\n");

n++ ;
}while (1) ;

#ifdef reein
 /*
 do {
    fprintf(stderr, "in main 1 \n");

      printf("set size 0.7,0.7\n");
      printf("set origin 0.1,0.1\n");
      printf("plot \"temp.txt\" with points\n");
       for (i=0; i<0x10000000; i++) {
            n=n+1 ;
        }
} while (1) ;

       printf("set multiplot\n");
       printf("set size 0.4,0.4\n");
       printf("set origin 0.1,0.1\n");

    init_plot();  
  do {
    printf("plot \"-\" with points\n");
        for (i=0; i<0x10; i++) {
            printf("%6d %12.2f\n", i, (float)i);
        }
        printf("e\n\n");

      printf("set size 0.2,0.2\n");
       printf("set origin 0.5,0.5\n");
    printf("plot \"-\" with points\n");

       for (i=0; i<0x10; i++) {
            printf("%6d %12.2f\n", i, (float)i+i);
        }
        printf("e\n\n");

       printf("set nomultiplot\n");
*/
    fprintf(stderr, "in main 1 \n");

    do {
        int n, i;
        struct speed *e;
    n = (n + 1) & 0xfff ;
   

    printf("plot \"-\" with points\n");

    for (i=0; i<0x10; i++) {
            printf("%6d %12.2f\n", i, (float)n);
        }
        printf("e\n\n");

         plot_it();
    } while (1);
#endif

    return 0;
}


