+#define MAX_SIZE 1024
+#define PRINT_RATE 100
+
+int print_rate(struct timeval *time_start,int t) {
+ struct timeval now;
+ int sec_t,usec_t;
+ unsigned int delta_t;
+ unsigned int kbs_t;
+ int count;
+
+ gettimeofday(&now,NULL);
+ sec_t=now.tv_sec-time_start->tv_sec;
+ usec_t=(now.tv_usec<time_start->tv_usec)
+ ?1000000-time_start->tv_usec+now.tv_usec
+ :now.tv_usec-time_start->tv_usec;
+ delta_t=sec_t*1000000+usec_t;
+ kbs_t=(t/delta_t)*(1000000/1024);
+ count=printf("total: %d MByte - average: %d kB/s",t/(1024*1024),kbs_t);
+ while(count--) printf("\b");
+
+ return 1;
+}