Esempio n. 1
0
void
pb_PrintTimerSet(struct pb_TimerSet *timers)
{

  pb_Timestamp wall_end = get_time();

  struct pb_Timer *t = timers->timers;
  struct pb_SubTimer* sub = NULL;
  
  int maxSubLength;
    
  const char *categories[] = {
    "IO", "Kernel", "Copy", "Driver", "Copy Async", "Compute"
  };
  
  const int maxCategoryLength = 10;
  
  int i;
  for(i = 1; i < pb_TimerID_LAST-1; ++i) { // exclude NONE and OVRELAP from this format
    if(pb_GetElapsedTime(&t[i]) != 0) {
    
      // Print Category Timer
      printf("%-*s: %f\n", maxCategoryLength, categories[i-1], pb_GetElapsedTime(&t[i]));
      
      if (timers->sub_timer_list[i] != NULL) {
        sub = timers->sub_timer_list[i]->subtimer_list;
        maxSubLength = 0;
        while (sub != NULL) {
          // Find longest SubTimer label
          if (strlen(sub->label) > maxSubLength) {
            maxSubLength = strlen(sub->label);
          }
          sub = sub->next;
        }
        
        // Fit to Categories
        if (maxSubLength <= maxCategoryLength) {
         maxSubLength = maxCategoryLength;
        }
        
        sub = timers->sub_timer_list[i]->subtimer_list;
        
        // Print SubTimers
        while (sub != NULL) {
          printf(" -%-*s: %f\n", maxSubLength, sub->label, pb_GetElapsedTime(&sub->timer));
          sub = sub->next;
        }
      }
    }
  }
  
  if(pb_GetElapsedTime(&t[pb_TimerID_OVERLAP]) != 0)
    printf("CPU/Kernel Overlap: %f\n", pb_GetElapsedTime(&t[pb_TimerID_OVERLAP]));
        
  float walltime = (wall_end - timers->wall_begin)/ 1e6;
  printf("Timer Wall Time: %f\n", walltime);  
  
}
Esempio n. 2
0
void
pb_PrintTimerSet(struct pb_TimerSet *timers)
{
  struct pb_Timer *t = timers->timers;
  printf("IO:      %f\n", pb_GetElapsedTime(&t[pb_TimerID_IO]));
  printf("GPU:     %f\n", pb_GetElapsedTime(&t[pb_TimerID_GPU]));
  printf("Copy:    %f\n", pb_GetElapsedTime(&t[pb_TimerID_COPY]));
  printf("Compute: %f\n", pb_GetElapsedTime(&t[pb_TimerID_COMPUTE]));
}
Esempio n. 3
0
void
pb_PrintTimerSet(struct pb_TimerSet *timers)
{
  struct pb_Timer *t = timers->timers;
  /* Presumably every application will have an I/O component */
  printf("IO:      %f\n", pb_GetElapsedTime(&t[pb_TimerID_IO]));
  if(pb_GetElapsedTime(&t[pb_TimerID_GPU]) != 0)
    printf("GPU:     %f\n", pb_GetElapsedTime(&t[pb_TimerID_GPU]));
  if(pb_GetElapsedTime(&t[pb_TimerID_COPY]) != 0)
    printf("Copy:    %f\n", pb_GetElapsedTime(&t[pb_TimerID_COPY]));
  if(pb_GetElapsedTime(&t[pb_TimerID_DRIVER]) != 0)
    printf("Driver:  %f\n", pb_GetElapsedTime(&t[pb_TimerID_DRIVER]));
  /* Presumably every application will have a CPU compute component */
  printf("Compute: %f\n", pb_GetElapsedTime(&t[pb_TimerID_COMPUTE]));
  if(pb_GetElapsedTime(&t[pb_TimerID_OVERLAP]) != 0)
    printf("CPU/GPU Overlap: %f\n", pb_GetElapsedTime(&t[pb_TimerID_OVERLAP]));
}