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

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Logging database statement duration in a DRY way
Date Fri, 19 Aug 2016 16:05:57 -0000 (UTC)
Organization A noiseless patient Spider
Lines 17
Message-ID <np7ap5$sqd$1@dont-email.me> (permalink)
References <87wpjdhrbm.fsf@Equus.decebal.nl>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Fri, 19 Aug 2016 16:05:57 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="29517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199R7cO3H/Ezc25h/kf0/ifO9vFcHDeTug="
User-Agent Pan/0.140 (Chocolate Salty Balls; GIT 3663720 git://git.gnome.org/pan2)
Cancel-Lock sha1:QZ5t9V9WLPi+4iIMysxnfqSrRos=
Xref csiph.com comp.lang.java.programmer:35413

Show key headers only | 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