Commit 0e8f5148 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

Closes #2133 refs[t:2133] Restore 15630: Merged engine status logic for...

Closes #2133 refs[t:2133] Restore 15630: Merged engine status logic for scheduling statistics from 2.2.0.

git-svn-id: file:///svn/mysql/tokudb-engine/src@15778 c7de825b-a66e-492c-adef-691d508d4ae1
parent 33f2172d
......@@ -744,85 +744,114 @@ static bool tokudb_show_logs(THD * thd, stat_print_fn * stat_print) {
val, \
strlen(val))
static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
TOKUDB_DBUG_ENTER("tokudb_show_engine_status");
int error;
char buf[1024] = {'\0'};
const int bufsiz = 1024;
char buf[bufsiz] = {'\0'};
ENGINE_STATUS engstat;
error = db_env->get_engine_status(db_env, &engstat);
if (error == 0) {
STATPRINT("time now", engstat.now);
const char * lockstat = (engstat.ydb_lock_ctr & 0x01) ? "Locked" : "Unlocked";
u_int32_t lockctr = engstat.ydb_lock_ctr >> 1; // lsb indicates if locked
sprintf(buf, "%" PRIu32, lockctr);
u_int64_t lockctr = engstat.ydb_lock_ctr >> 1; // lsb indicates if locked
snprintf(buf, bufsiz, "%" PRIu64, lockctr);
STATPRINT("ydb lock", lockstat);
STATPRINT("ydb lock counter", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.max_possible_sleep);
STATPRINT("max_possible_sleep (microseconds)", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.processor_freq_mhz);
STATPRINT("processor_freq_mhz", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.max_requested_sleep);
STATPRINT("max_requested_sleep", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.times_max_sleep_used);
STATPRINT("times_max_sleep_used", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.total_sleepers);
STATPRINT("total_sleepers", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.total_sleep_time);
STATPRINT("total_sleep_time", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.max_waiters);
STATPRINT("max_waiters", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.total_waiters);
STATPRINT("total_waiters", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.total_clients);
STATPRINT("total_clients", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.time_ydb_lock_held_unavailable);
STATPRINT("time_ydb_lock_held_unavailable", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.max_time_ydb_lock_held);
STATPRINT("max_time_ydb_lock_held", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.total_time_ydb_lock_held);
STATPRINT("total_time_ydb_lock_held", buf);
lockstat = (engstat.logger_lock_ctr & 0x01) ? "Locked" : "Unlocked";
lockctr = engstat.logger_lock_ctr >> 1; // lsb indicates if locked
sprintf(buf, "%" PRIu32, lockctr);
snprintf(buf, bufsiz, "%" PRIu64, lockctr);
STATPRINT("logger lock", lockstat);
STATPRINT("logger lock counter", buf);
//lockstat = (engstat.cachetable_lock_ctr & 0x01) ? "Locked" : "Unlocked";
//lockctr = engstat.cachetable_lock_ctr >> 1; // lsb indicates if locked
sprintf(buf, "%" PRIu32, lockctr);
STATPRINT("cachetable lock", lockstat);
STATPRINT("cachetable lock counter", buf);
snprintf(buf, bufsiz, "%" PRIu32, engstat.checkpoint_period);
STATPRINT("checkpoint period", buf);
snprintf(buf, bufsiz, "%" PRIu32, engstat.checkpoint_footprint);
STATPRINT("checkpoint status code (0 = idle)", buf);
STATPRINT("last checkpoint began ", engstat.checkpoint_time_begin);
STATPRINT("last complete checkpoint began ", engstat.checkpoint_time_begin_complete);
STATPRINT("last complete checkpoint ended ", engstat.checkpoint_time_end);
sprintf(buf, "%" PRIu64, engstat.cachetable_hit);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_lock_taken);
STATPRINT("cachetable lock taken", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_lock_released);
STATPRINT("cachetable lock released", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_hit);
STATPRINT("cachetable hit", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_miss);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_miss);
STATPRINT("cachetable miss", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_wait_reading);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_misstime);
STATPRINT("cachetable misstime", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_waittime);
STATPRINT("cachetable waittime", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_wait_reading);
STATPRINT("cachetable wait reading", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_wait_writing);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_wait_writing);
STATPRINT("cachetable wait writing", buf);
sprintf(buf, "%" PRIu64, engstat.puts);
snprintf(buf, bufsiz, "%" PRIu64, engstat.puts);
STATPRINT("cachetable puts (new node)", buf);
sprintf(buf, "%" PRIu64, engstat.prefetches);
snprintf(buf, bufsiz, "%" PRIu64, engstat.prefetches);
STATPRINT("cachetable prefetches", buf);
sprintf(buf, "%" PRIu64, engstat.maybe_get_and_pins);
snprintf(buf, bufsiz, "%" PRIu64, engstat.maybe_get_and_pins);
STATPRINT("cachetable maybe_get_and_pins", buf);
sprintf(buf, "%" PRIu64, engstat.maybe_get_and_pin_hits);
snprintf(buf, bufsiz, "%" PRIu64, engstat.maybe_get_and_pin_hits);
STATPRINT("cachetable maybe_get_and_pin_hits", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_size_current);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_current);
STATPRINT("cachetable size_current", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_size_limit);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_limit);
STATPRINT("cachetable size_limit", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_size_writing);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_writing);
STATPRINT("cachetable size_writing", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.get_and_pin_footprint);
STATPRINT("cachetable get_and_pin_footprint", buf);
sprintf(buf, "%" PRIu32, engstat.checkpoint_period);
STATPRINT("checkpoint period", buf);
sprintf(buf, "%" PRIu32, engstat.checkpoint_footprint);
STATPRINT("checkpoint status code (0 = idle)", buf);
STATPRINT("last complete checkpoint began ", engstat.checkpoint_time_begin_complete);
STATPRINT("last complete checkpoint ended ", engstat.checkpoint_time_end);
STATPRINT("last checkpoint began ", engstat.checkpoint_time_begin);
sprintf(buf, "%" PRIu32, engstat.range_locks_max);
snprintf(buf, bufsiz, "%" PRIu32, engstat.range_locks_max);
STATPRINT("max range locks", buf);
sprintf(buf, "%" PRIu32, engstat.range_locks_max_per_db);
snprintf(buf, bufsiz, "%" PRIu32, engstat.range_locks_max_per_db);
STATPRINT("max range locks per db", buf);
sprintf(buf, "%" PRIu32, engstat.range_locks_curr);
snprintf(buf, bufsiz, "%" PRIu32, engstat.range_locks_curr);
STATPRINT("range locks in use", buf);
sprintf(buf, "%" PRIu64, engstat.inserts);
snprintf(buf, bufsiz, "%" PRIu64, engstat.inserts);
STATPRINT("dictionary inserts", buf);
sprintf(buf, "%" PRIu64, engstat.deletes);
snprintf(buf, bufsiz, "%" PRIu64, engstat.deletes);
STATPRINT("dictionary deletes", buf);
sprintf(buf, "%" PRIu64, engstat.point_queries);
snprintf(buf, bufsiz, "%" PRIu64, engstat.point_queries);
STATPRINT("dictionary point queries", buf);
sprintf(buf, "%" PRIu64, engstat.sequential_queries);
snprintf(buf, bufsiz, "%" PRIu64, engstat.sequential_queries);
STATPRINT("dictionary sequential queries", buf);
sprintf(buf, "%" PRIu64, engstat.commits);
snprintf(buf, bufsiz, "%" PRIu64, engstat.commits);
STATPRINT("txn commits", buf);
sprintf(buf, "%" PRIu64, engstat.aborts);
snprintf(buf, bufsiz, "%" PRIu64, engstat.aborts);
STATPRINT("txn aborts", buf);
}
if (error) { my_errno = error; }
......@@ -885,6 +914,9 @@ cleanup:
return error;
}
bool tokudb_show_status(handlerton * hton, THD * thd, stat_print_fn * stat_print, enum ha_stat_type stat_type) {
switch (stat_type) {
case HA_ENGINE_DATA_AMOUNT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment