Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35413

Re: Logging database statement duration in a DRY way

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Logging database statement duration in a DRY way
Date 2016-08-19 16:05 +0000
Organization A noiseless patient Spider
Message-ID <np7ap5$sqd$1@dont-email.me> (permalink)
References <87wpjdhrbm.fsf@Equus.decebal.nl>

Show all headers | View raw


On Fri, 19 Aug 2016 14:32:45 +0200, Cecil Westerhof wrote:

> I like to log the time it takes for certain database actions.

You could write a StopWatch class with start() and stop() methods:
start() would grab the current time and stop() would return the amount of 
time since start() was called as milliseconds or nanoseconds. Different 
instances can be used to time various parts of an application. It would 
be trivial to put it under the control of a multi-level debug class or 
classes so that timing measurements are only made at appropriate debug 
levels.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Logging database statement duration in a DRY way Cecil Westerhof <Cecil@decebal.nl> - 2016-08-19 14:32 +0200
  Re: Logging database statement duration in a DRY way Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-19 09:05 -0400
    Re: Logging database statement duration in a DRY way Cecil Westerhof <Cecil@decebal.nl> - 2016-08-19 20:54 +0200
  Re: Logging database statement duration in a DRY way Cecil Westerhof <Cecil@decebal.nl> - 2016-08-19 15:12 +0200
    Re: Logging database statement duration in a DRY way Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-19 10:01 -0400
    Re: Logging database statement duration in a DRY way Arne Vajhøj <arne@vajhoej.dk> - 2016-08-19 22:17 -0400
      Re: Logging database statement duration in a DRY way Arne Vajhøj <arne@vajhoej.dk> - 2016-08-19 22:37 -0400
  Re: Logging database statement duration in a DRY way Martin Gregorie <martin@address-in-sig.invalid> - 2016-08-19 16:05 +0000
    Re: Logging database statement duration in a DRY way Eric Douglas <e.d.programmer@gmail.com> - 2016-08-19 10:06 -0700
  Re: Logging database statement duration in a DRY way Steven Simpson <ss@my.domain.invalid> - 2016-08-19 22:34 +0100

csiph-web