~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/stats_schema.cc

  • Committer: Joe Daly
  • Date: 2010-06-06 19:14:51 UTC
  • mto: This revision was merged to the branch mainline in revision 1614.
  • Revision ID: skinny.moey@gmail.com-20100606191451-0djaqisn80k21oti
remove a class that was for debug purposes, as well as remove a function that was for debug purposes

Show diffs side-by-side

added added

removed removed

Lines of Context:
334
334
 
335
335
  return false;
336
336
}
337
 
 
338
 
StatusVarTool::StatusVarTool(LoggingStats *logging_stats) :
339
 
  plugin::TableFunction("DATA_DICTIONARY", "CUMULATIVE_USER_STATS")
340
 
{
341
 
  outer_logging_stats= logging_stats;
342
 
 
343
 
  add_field("USER");
344
 
  add_field("BYTES_RECEIVED", TableFunction::NUMBER);
345
 
  add_field("BYTES_SENT", TableFunction::NUMBER);
346
 
}
347
 
 
348
 
StatusVarTool::Generator::Generator(Field **arg, LoggingStats *logging_stats) :
349
 
  plugin::TableFunction::Generator(arg)
350
 
{
351
 
  inner_logging_stats= logging_stats;
352
 
  record_number= 0;
353
 
 
354
 
  if (inner_logging_stats->isEnabled())
355
 
  {
356
 
    last_valid_index= inner_logging_stats->getCumulativeStats()->getCumulativeStatsLastValidIndex();
357
 
  }
358
 
  else
359
 
  {
360
 
    last_valid_index= INVALID_INDEX;
361
 
  }
362
 
}
363
 
 
364
 
bool StatusVarTool::Generator::populate()
365
 
{
366
 
  if ((record_number > last_valid_index) || (last_valid_index == INVALID_INDEX))
367
 
  {
368
 
    return false;
369
 
  }
370
 
 
371
 
  while (record_number <= last_valid_index)
372
 
  {
373
 
    ScoreboardSlot *cumulative_scoreboard_slot=
374
 
      inner_logging_stats->getCumulativeStats()->getCumulativeStatsByUserVector()->at(record_number);
375
 
 
376
 
    if (cumulative_scoreboard_slot->isInUse())
377
 
    {
378
 
      StatusVars *status_vars= cumulative_scoreboard_slot->getStatusVars();
379
 
      push(cumulative_scoreboard_slot->getUser());
380
 
      push(status_vars->getStatusVarCounters()->bytes_received);
381
 
      push(status_vars->getStatusVarCounters()->bytes_sent);
382
 
 
383
 
      ++record_number;
384
 
      return true;
385
 
    }
386
 
    else
387
 
    {
388
 
      ++record_number;
389
 
    }
390
 
  }
391
 
 
392
 
  return false;
393
 
}