Esempio n. 1
0
int send_done_and_pr_msgs(double total_time, double t_page)
{
  int exit_code1 =0;
  int exit_code2 =0;
  int exit_code3 =0;

  send_all_done_cmd();

  /* exit_code1 !=0 if there are files that were not delivered due to change or skipped */  
  exit_code1 = pr_missing_pages();

  fprintf(stderr, "Total time spent = %6.2f (min) ~ %6.2f (min/GB)\n\n", 
	  total_time, total_time / ((double)real_total_bytes/1.0e9));
  fprintf(stderr, "Send pages time  = %6.2f (min) ~ %6.2f (min/GB)\n\n", 
	  t_page, t_page / ((double)real_total_bytes/1.0e9));

  exit_code2 = choose_print_machines(bad_machines, 
				     BAD_MACHINE, 
				     "Not synced for bad machines:[ ");

  if (quitWithOneBad && nBadMachines() >=1) {
    fprintf(stderr, "We choose to exit when at least one target is bad\n");
    fprintf(stderr, "All files following the current one did not get delivered\n");
    fprintf(stderr, "If resend cmd(CLOSE_FILE), then the current file may have been delivered to non-bad targets\n\n");
  }

  if (current_entry() < total_entries()) { /* if we exit prematurely */
    exit_code3 = choose_print_machines(machine_status, 
				       NOT_READY, "\nNot-ready machines:[  ");
  }

  if (verbose>=1) pr_rtt_hist();
  return (exit_code1+exit_code3); /* 200807 removed exit_code2 because bad machines case has been dealt with 
                                     by -q.  If no -q, then the bad machines are considered 'harmless' */
}
Esempio n. 2
0
int pr_missing_pages()
{
  int i, N, exit_code=0;
  off_t delta;
  unsigned int dp;

  for(i=0; i<nMachines; ++i) {
    char name[PATH_MAX];
    N = get_total_missing_pages(i);
    strcpy(name, id2name(i));
    if (strlen(name)==0) sprintf(name, "machine(%3d)", i);
    fprintf(stderr, "%s: #_missing_page_request = %6.2f%% = %d\n", 
	    name, (double)N/((double)total_pages)*100.0, N);
  }

  if (skip_count>0) {
    fprintf(stderr, "\nWarning: There are %d files which are not delivered.\n", skip_count);
    exit_code = -1;
  }

  fprintf(stderr, "\nTotal number of files = %12d Pages w/o ack = %12u (%6.2f%%)\n", 
	  total_entries(), pages_wo_ack(), (double)pages_wo_ack()/(double)real_total_pages*100.0);

  dp = real_total_pages - total_pages;
  fprintf(stderr, "Total number of pages = %12d Pages re-sent = %12u (%6.2f%%)\n", 
	  total_pages, dp, (double)dp/(double)total_pages*100.0);

  delta = (off_t)(real_total_bytes - total_bytes);
  #ifdef _LARGEFILE_SOURCE
  fprintf(stderr, "Total number of bytes = %12llu Bytes re-sent = %12llu (%6.2f%%)\n",
	  total_bytes, delta, (double)delta/(double)total_bytes*100.0);
  #else
  fprintf(stderr, "Total number of bytes = %12d Bytes re-sent = %12u (%6.2f%%)\n",
	  total_bytes, delta, (double)delta/(double)total_bytes*100.0);
  #endif

  return (exit_code);
}  
Esempio n. 3
0
 // Return the number of entries recorded so far with the given outcome as
 // a fraction of the total number recorded so far.
 double fraction_for_outcome(int outcome) {
   return
     (double)entries_for_outcome(outcome)/
     (double)total_entries();
 }