~sysbench-developers/sysbench/0.4

« back to all changes in this revision

Viewing changes to sysbench/sb_logger.c

  • Committer: Alexey Kopytov
  • Date: 2011-07-21 16:59:45 UTC
  • Revision ID: akopytov@gmail.com-20110721165945-gj70m6zgsm5x56kr
Make --report-interval stats use the --percentile value rather than
hardcoded ones.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
static unsigned char verbosity; 
61
61
 
62
62
static sb_percentile_t percentile;
63
 
static unsigned int    oper_percentile;
64
63
 
65
64
static pthread_mutex_t text_mutex;
66
65
static unsigned int    text_cnt;
484
483
 
485
484
int oper_handler_init(void)
486
485
{
487
 
  unsigned int i;
 
486
  unsigned int i, tmp;
488
487
 
489
 
  oper_percentile = sb_get_value_int("percentile");
490
 
  if (oper_percentile < 1 || oper_percentile > 100)
 
488
  tmp = sb_get_value_int("percentile");
 
489
  if (tmp < 1 || tmp > 100)
491
490
  {
492
491
    log_text(LOG_FATAL, "Invalid value for percentile option: %d",
493
 
             oper_percentile);
 
492
             tmp);
494
493
    return 1;
495
494
  }
 
495
  sb_globals.percentile_rank = tmp;
496
496
 
497
497
  if (sb_percentile_init(&percentile, OPER_LOG_GRANULARITY, OPER_LOG_MIN_VALUE,
498
498
                         OPER_LOG_MAX_VALUE))
577
577
 
578
578
  total_time_ns = sb_timer_split(&sb_globals.cumulative_timer2);
579
579
 
580
 
  percentile_val = sb_percentile_calculate(&percentile, oper_percentile);
 
580
  percentile_val = sb_percentile_calculate(&percentile,
 
581
                                           sb_globals.percentile_rank);
581
582
  sb_percentile_reset(&percentile);
582
583
 
583
584
  pthread_mutex_unlock(&timers_mutex);
607
608
  if (t.events > 0)
608
609
  {
609
610
    log_text(LOG_NOTICE, "         approx. %3d percentile:         %10.2fms",
610
 
             oper_percentile, NS2MS(percentile_val));
 
611
             sb_globals.percentile_rank, NS2MS(percentile_val));
611
612
  }
612
613
  log_text(LOG_NOTICE, "");
613
614