From 573ce7859bd69d65f2d1c2eff1fb992d3d6a64c2 Mon Sep 17 00:00:00 2001 From: mdb Date: Mon, 24 Jan 2005 17:15:40 +0000 Subject: [PATCH] Added the ability to clear a unit profile. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1578 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/util/Invoker.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/Invoker.java b/projects/samskivert/src/java/com/samskivert/util/Invoker.java index 7e27c220..ee4a0e01 100644 --- a/projects/samskivert/src/java/com/samskivert/util/Invoker.java +++ b/projects/samskivert/src/java/com/samskivert/util/Invoker.java @@ -179,14 +179,17 @@ public class Invoker extends LoopingThread /** Used to track profile information on invoked units. */ protected static class UnitProfile { - public void record (long duration) - { + public void record (long duration) { _totalElapsed += duration; _histo.addValue((int)duration); } - public String toString () - { + public void clear () { + _totalElapsed = 0L; + _histo.clear(); + } + + public String toString () { int count = _histo.size(); return _totalElapsed + "ms/" + count + " = " + (_totalElapsed/count) + "ms avg " +