Manual merge from 0.4

This commit is contained in:
Alexey Kopytov
2011-07-21 21:02:14 +04:00
3 changed files with 13 additions and 10 deletions

View File

@ -831,13 +831,14 @@ void db_print_stats(sb_stat_t type)
log_timestamp(LOG_NOTICE, &sb_globals.exec_timer,
"threads: %d, tps: %4.2f, reads/s: %4.2f, writes/s: %4.2f "
"response time: %4.2fms (95%%), %4.2fms (99%%)",
"response time: %4.2fms (%u%%)",
sb_globals.num_threads,
(transactions - last_transactions) / seconds,
(read_ops - last_read_ops) / seconds,
(write_ops - last_write_ops) / seconds,
NS2MS(sb_percentile_calculate(&local_percentile, 95)),
NS2MS(sb_percentile_calculate(&local_percentile, 99)));
NS2MS(sb_percentile_calculate(&local_percentile,
sb_globals.percentile_rank)),
sb_globals.percentile_rank);
SB_THREAD_MUTEX_LOCK();
last_transactions = transactions;

View File

@ -57,7 +57,6 @@ static sb_list_t handlers[LOG_MSG_TYPE_MAX];
static unsigned char initialized;
static sb_percentile_t percentile;
static unsigned int oper_percentile;
static pthread_mutex_t text_mutex;
static unsigned int text_cnt;
@ -480,15 +479,16 @@ int text_handler_process(log_msg_t *msg)
int oper_handler_init(void)
{
unsigned int i;
unsigned int i, tmp;
oper_percentile = sb_get_value_int("percentile");
if (oper_percentile < 1 || oper_percentile > 100)
tmp = sb_get_value_int("percentile");
if (tmp < 1 || tmp > 100)
{
log_text(LOG_FATAL, "Invalid value for percentile option: %d",
oper_percentile);
tmp);
return 1;
}
sb_globals.percentile_rank = tmp;
if (sb_percentile_init(&percentile, OPER_LOG_GRANULARITY, OPER_LOG_MIN_VALUE,
OPER_LOG_MAX_VALUE))
@ -573,7 +573,8 @@ int print_global_stats(void)
total_time_ns = sb_timer_split(&sb_globals.cumulative_timer2);
percentile_val = sb_percentile_calculate(&percentile, oper_percentile);
percentile_val = sb_percentile_calculate(&percentile,
sb_globals.percentile_rank);
sb_percentile_reset(&percentile);
pthread_mutex_unlock(&timers_mutex);
@ -603,7 +604,7 @@ int print_global_stats(void)
if (t.events > 0)
{
log_text(LOG_NOTICE, " approx. %3d percentile: %10.2fms",
oper_percentile, NS2MS(percentile_val));
sb_globals.percentile_rank, NS2MS(percentile_val));
}
log_text(LOG_NOTICE, "");

View File

@ -201,6 +201,7 @@ typedef struct
unsigned int num_threads; /* number of threads to use */
unsigned int num_running; /* number of threads currently active */
unsigned int report_interval;/* intermediate reports interval */
unsigned int percentile_rank;/* percentile rank for response time stats */
/* array of report checkpoints */
unsigned int checkpoints[MAX_CHECKPOINTS];
unsigned int n_checkpoints; /* number of checkpoints */