Esempio n. 1
0
/**
 * record one event
 *
 * @param stat, pointer of the statistic structure
 * @param total_time, response time of the command
 * @param get_miss, whether it gets miss
 */
void ms_record_event(ms_stat_t *stat, uint64_t total_time, int get_miss)
{
  if(stat->all_times_count < ALL_TIMES && stat->all_times_count > -1 ){
     stat->all_times_lt[stat->all_times_count] = total_time;
     struct timespec ts; 
     clock_gettime(CLOCK_REALTIME, &ts);
     stat->all_times_ts[stat->all_times_count] = ts.tv_sec * 1000 * 1000 * 1000 + ts.tv_nsec; 
     stat->all_times_count++;
  }

  stat->total_time+= total_time;

  if (total_time < stat->min_time)
  {
    stat->min_time= total_time;
  }

  if (total_time > stat->max_time)
  {
    stat->max_time= total_time;
  }

  if (total_time < stat->period_min_time)
  {
    stat->period_min_time= total_time;
  }

  if (total_time > stat->period_max_time)
  {
    stat->period_max_time= total_time;
  }

  if (get_miss)
  {
    stat->get_miss++;
  }

  stat->dist[ms_local_log2(total_time)]++;
  stat->squares+= (double)(total_time * total_time);

  if (total_time != 0)
  {
    stat->log_product+= log((double)total_time);
  }
} /* ms_record_event */
Esempio n. 2
0
/**
 * record one event
 *
 * @param stat, pointer of the statistic structure
 * @param total_time, response time of the command
 * @param get_miss, whether it gets miss
 */
void ms_record_event(ms_stat_t *stat, uint64_t total_time, int get_miss)
{
  stat->total_time+= total_time;

  if (total_time < stat->min_time)
  {
    stat->min_time= total_time;
  }

  if (total_time > stat->max_time)
  {
    stat->max_time= total_time;
  }

  if (total_time < stat->period_min_time)
  {
    stat->period_min_time= total_time;
  }

  if (total_time > stat->period_max_time)
  {
    stat->period_max_time= total_time;
  }

  if (get_miss)
  {
    stat->get_miss++;
  }

  stat->dist[ms_local_log2(total_time)]++;
  stat->squares+= (double)(total_time * total_time);

  if (total_time != 0)
  {
    stat->log_product+= log((double)total_time);
  }
} /* ms_record_event */