~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/stats_schema.cc

  • Committer: Joseph Daly
  • Date: 2010-08-18 02:17:48 UTC
  • mto: (1725.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1726.
  • Revision ID: jdaly@rx7-20100818021748-f07775vmvq1o6vq9
add memory usage

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
}