~linuxjedi/drizzle/drizzle-bug-621603

« back to all changes in this revision

Viewing changes to plugin/logging_stats/stats_schema.cc

  • Committer: Monty Taylor
  • Date: 2010-08-21 08:44:38 UTC
  • mfrom: (1725.1.5 build)
  • Revision ID: mordred@inaugust.com-20100821084438-xco4t67quey63o0i
Visibility, suppressions and bugfixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
454
454
 
455
455
  return false;
456
456
}
 
457
 
 
458
ScoreboardStatsTool::ScoreboardStatsTool(LoggingStats *logging_stats) :
 
459
  plugin::TableFunction("DATA_DICTIONARY", "SCOREBOARD_STATISTICS")
 
460
{
 
461
  outer_logging_stats= logging_stats;
 
462
 
 
463
  add_field("SCOREBOARD_SIZE", TableFunction::NUMBER);
 
464
  add_field("NUMBER_OF_RANGE_LOCKS", TableFunction::NUMBER);
 
465
  add_field("MAX_USERS_LOGGED", TableFunction::NUMBER);
 
466
  add_field("MEMORY_USAGE_BYTES", TableFunction::NUMBER);
 
467
}
 
468
 
 
469
ScoreboardStatsTool::Generator::Generator(Field **arg, LoggingStats *logging_stats) :
 
470
  plugin::TableFunction::Generator(arg)
 
471
{
 
472
  inner_logging_stats= logging_stats;
 
473
  is_last_record= false; 
 
474
}
 
475
 
 
476
bool ScoreboardStatsTool::Generator::populate()
 
477
{
 
478
  if (is_last_record)
 
479
  {
 
480
    return false;
 
481
  }
 
482
 
 
483
  Scoreboard *scoreboard= inner_logging_stats->getCurrentScoreboard();
 
484
  CumulativeStats *cumulativeStats= inner_logging_stats->getCumulativeStats();
 
485
 
 
486
  push(static_cast<uint64_t>(scoreboard->getNumberPerBucket() * scoreboard->getNumberBuckets()));
 
487
  push(static_cast<uint64_t>(scoreboard->getNumberBuckets()));
 
488
  push(static_cast<uint64_t>(cumulativeStats->getCumulativeStatsByUserMax()));
 
489
  push(cumulativeStats->getCumulativeSizeBytes() + scoreboard->getScoreboardSizeBytes()); 
 
490
  
 
491
  is_last_record= true;
 
492
 
 
493
  return true;
 
494
}