~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/logging_stats.cc

  • Committer: Olaf van der Spek
  • Date: 2011-03-23 09:39:54 UTC
  • mto: (2247.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2248.
  • Revision ID: olafvdspek@gmail.com-20110323093954-ytoq6iy28nvb5uo1
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
270
270
  }
271
271
}
272
272
 
273
 
static bool initTable()
 
273
static int init(drizzled::module::Context &context)
274
274
{
 
275
  const module::option_map &vm= context.getOptions();
 
276
  sysvar_logging_stats_enabled= not vm.count("disable");
 
277
 
 
278
  logging_stats= new LoggingStats("logging_stats");
275
279
  current_commands_tool= new CurrentCommandsTool(logging_stats);
276
280
  cumulative_commands_tool= new CumulativeCommandsTool(logging_stats);
277
281
  global_statements_tool= new GlobalStatementsTool(logging_stats);
280
284
  global_status_tool= new StatusTool(logging_stats, false);
281
285
  cumulative_user_stats_tool= new CumulativeUserStatsTool(logging_stats);
282
286
  scoreboard_stats_tool= new ScoreboardStatsTool(logging_stats);
283
 
  return false; // todo: return void
284
 
}
285
 
 
286
 
static int init(drizzled::module::Context &context)
287
 
{
288
 
  const module::option_map &vm= context.getOptions();
289
 
 
290
 
  sysvar_logging_stats_enabled= (vm.count("disable")) ? false : true;
291
 
 
292
 
  logging_stats= new LoggingStats("logging_stats");
293
 
 
294
 
  if (initTable())
295
 
  {
296
 
    return 1;
297
 
  }
298
287
 
299
288
  context.add(logging_stats);
300
289
  context.add(current_commands_tool);
307
296
  context.add(scoreboard_stats_tool);
308
297
 
309
298
  if (sysvar_logging_stats_enabled)
310
 
  {
311
299
    logging_stats->enable();
312
 
  }
313
300
 
314
301
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("max_user_count", sysvar_logging_stats_max_user_count));
315
302
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("bucket_count", sysvar_logging_stats_bucket_count));