~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_gearman/logging_gearman.cc

modifying folder structure

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008,2009 Sun Microsystems
 
4
 *  Copyright (C) 2008, 2009 Sun Microsystems, Inc.
5
5
 *
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
225
225
    if (not _gearman_client_ok)
226
226
        return false;
227
227
  
228
 
    /* TODO, the session object should have a "utime command completed"
229
 
       inside itself, so be more accurate, and so this doesnt have to
230
 
       keep calling current_utime, which can be slow */
231
 
  
232
 
    boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::local_time());
233
 
    boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
234
 
    uint64_t t_mark= (mytime-epoch).total_microseconds();
 
228
    /* 
 
229
      TODO, the session object should have a "utime command completed"
 
230
      inside itself, so be more accurate, and so this doesnt have to
 
231
      keep calling current_utime, which can be slow.
 
232
    */
 
233
    uint64_t t_mark= session->getCurrentTimestamp(false);
235
234
  
236
235
 
237
236
    // buffer to quotify the query
258
257
               drizzled::command_name[session->command].str,
259
258
               // counters are at end, to make it easier to add more
260
259
               (t_mark - session->getConnectMicroseconds()),
261
 
               (t_mark - session->start_utime),
 
260
               (session->getElapsedTime()),
262
261
               (t_mark - session->utime_after_lock),
263
262
               session->sent_row_count,
264
263
               session->examined_row_count,
300
299
{
301
300
  context("host",
302
301
          po::value<std::string>()->default_value("localhost"),
303
 
          N_("Hostname for logging to a Gearman server"));
 
302
          _("Hostname for logging to a Gearman server"));
304
303
  context("function",
305
304
          po::value<std::string>()->default_value("drizzlelog"),
306
 
          N_("Gearman Function to send logging to"));
 
305
          _("Gearman Function to send logging to"));
307
306
}
308
307
 
309
308
} /* namespace drizzle_plugin */