1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008,2009 Sun Microsystems
4
* Copyright (C) 2008, 2009 Sun Microsystems, Inc.
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
234
234
if (session->examined_row_count < sysvar_logging_query_threshold_big_examined.get())
237
/* TODO, the session object should have a "utime command completed"
238
inside itself, so be more accurate, and so this doesnt have to
239
keep calling current_utime, which can be slow */
241
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::local_time());
242
boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
243
uint64_t t_mark= (mytime-epoch).total_microseconds();
238
TODO, the session object should have a "utime command completed"
239
inside itself, so be more accurate, and so this doesnt have to
240
keep calling current_utime, which can be slow.
242
uint64_t t_mark= session->getCurrentTimestamp(false);
245
if ((t_mark - session->start_utime) < (sysvar_logging_query_threshold_slow.get()))
244
if (session->getElapsedTime() < (sysvar_logging_query_threshold_slow.get()))
248
247
Session::QueryString query_string(session->getQueryString());
275
274
% command_name[session->command].str
276
275
% (t_mark - session->getConnectMicroseconds())
277
% (t_mark - session->start_utime)
276
% session->getElapsedTime()
278
277
% (t_mark - session->utime_after_lock)
279
278
% session->sent_row_count
280
279
% session->examined_row_count
318
317
context("enable",
319
318
po::value<bool>(&sysvar_logging_query_enable)->default_value(false)->zero_tokens(),
320
N_("Enable logging to CSV file"));
319
_("Enable logging to CSV file"));
321
320
context("filename",
322
321
po::value<string>(),
323
N_("File to log to"));
322
_("File to log to"));
325
324
po::value<string>()->default_value(""),
326
N_("PCRE to match the query against"));
325
_("PCRE to match the query against"));
327
326
context("threshold-slow",
328
327
po::value<uint32_constraint>(&sysvar_logging_query_threshold_slow)->default_value(0),
329
N_("Threshold for logging slow queries, in microseconds"));
328
_("Threshold for logging slow queries, in microseconds"));
330
329
context("threshold-big-resultset",
331
330
po::value<uint32_constraint>(&sysvar_logging_query_threshold_big_resultset)->default_value(0),
332
N_("Threshold for logging big queries, for rows returned"));
331
_("Threshold for logging big queries, for rows returned"));
333
332
context("threshold-big-examined",
334
333
po::value<uint32_constraint>(&sysvar_logging_query_threshold_big_examined)->default_value(0),
335
N_("Threshold for logging big queries, for rows examined"));
334
_("Threshold for logging big queries, for rows examined"));
338
337
} /* namespace drizzle_plugin */