~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/logging_stats.cc

  • Committer: Lee Bieber
  • Date: 2011-03-23 23:16:25 UTC
  • mfrom: (2247.1.2 build)
  • Revision ID: kalebral@gmail.com-20110323231625-61k77qbh7n1iu776
Merge Olaf - Use BOOST_FOREACH
Merge Olaf - Remove std::nothrow from new()

Show diffs side-by-side

added added

removed removed

Lines of Context:
270
270
  }
271
271
}
272
272
 
273
 
static bool initTable()
274
 
{
275
 
  current_commands_tool= new(nothrow)CurrentCommandsTool(logging_stats);
276
 
 
277
 
  if (! current_commands_tool)
278
 
  {
279
 
    return true;
280
 
  }
281
 
 
282
 
  cumulative_commands_tool= new(nothrow)CumulativeCommandsTool(logging_stats);
283
 
 
284
 
  if (! cumulative_commands_tool)
285
 
  {
286
 
    return true;
287
 
  }
288
 
 
289
 
  global_statements_tool= new(nothrow)GlobalStatementsTool(logging_stats);
290
 
 
291
 
  if (! global_statements_tool)
292
 
  {
293
 
    return true;
294
 
  }
295
 
 
296
 
  session_statements_tool= new(nothrow)SessionStatementsTool(logging_stats);
297
 
 
298
 
  if (! session_statements_tool)
299
 
  {
300
 
    return true;
301
 
  }
302
 
 
303
 
  session_status_tool= new(nothrow)StatusTool(logging_stats, true);
304
 
 
305
 
  if (! session_status_tool)
306
 
  {
307
 
    return true;
308
 
  }
309
 
 
310
 
  global_status_tool= new(nothrow)StatusTool(logging_stats, false);
311
 
 
312
 
  if (! global_status_tool)
313
 
  {
314
 
    return true;
315
 
  }
316
 
 
317
 
  cumulative_user_stats_tool= new(nothrow)CumulativeUserStatsTool(logging_stats);
318
 
 
319
 
  if (! cumulative_user_stats_tool)
320
 
  {
321
 
    return true;
322
 
  }
323
 
 
324
 
  scoreboard_stats_tool= new(nothrow)ScoreboardStatsTool(logging_stats);
325
 
  
326
 
  if (! scoreboard_stats_tool)
327
 
  {
328
 
    return true;
329
 
  }
330
 
 
331
 
  return false;
332
 
}
333
 
 
334
273
static int init(drizzled::module::Context &context)
335
274
{
336
275
  const module::option_map &vm= context.getOptions();
337
 
 
338
 
  sysvar_logging_stats_enabled= (vm.count("disable")) ? false : true;
 
276
  sysvar_logging_stats_enabled= not vm.count("disable");
339
277
 
340
278
  logging_stats= new LoggingStats("logging_stats");
341
 
 
342
 
  if (initTable())
343
 
  {
344
 
    return 1;
345
 
  }
 
279
  current_commands_tool= new CurrentCommandsTool(logging_stats);
 
280
  cumulative_commands_tool= new CumulativeCommandsTool(logging_stats);
 
281
  global_statements_tool= new GlobalStatementsTool(logging_stats);
 
282
  session_statements_tool= new SessionStatementsTool(logging_stats);
 
283
  session_status_tool= new StatusTool(logging_stats, true);
 
284
  global_status_tool= new StatusTool(logging_stats, false);
 
285
  cumulative_user_stats_tool= new CumulativeUserStatsTool(logging_stats);
 
286
  scoreboard_stats_tool= new ScoreboardStatsTool(logging_stats);
346
287
 
347
288
  context.add(logging_stats);
348
289
  context.add(current_commands_tool);
355
296
  context.add(scoreboard_stats_tool);
356
297
 
357
298
  if (sysvar_logging_stats_enabled)
358
 
  {
359
299
    logging_stats->enable();
360
 
  }
361
300
 
362
301
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("max_user_count", sysvar_logging_stats_max_user_count));
363
302
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("bucket_count", sysvar_logging_stats_bucket_count));