org.LexGrid.util
Class SimpleMemUsageReporter

java.lang.Object
  extended by org.LexGrid.util.SimpleMemUsageReporter

public class SimpleMemUsageReporter
extends java.lang.Object

Tool for simple "heap profiling" over long runs where it is inconvenient to use an actual profiling tool.

Version:
subversion $Revision: 6045 $ checked in on $Date: 2007-10-10 12:19:17 +0000 (Wed, 10 Oct 2007) $
Author:
Jesse Erdmann

Nested Class Summary
static class SimpleMemUsageReporter.Snapshot
          Convenience class for holding information about the heap
 
Constructor Summary
SimpleMemUsageReporter()
           
 
Method Summary
static java.lang.String formatMemStat(long value)
          Static method for changing a long representing memory size to a human friendly string
static java.lang.String formatTimeDiff(long timeDiff)
          Used to convert the time difference between snapshots to a human readable format
static void init()
          Initialize values
static void main(java.lang.String[] args)
          A simple test to make sure the output is sensible
static void print(SimpleMemUsageReporter.Snapshot snap)
          Convenience printer
static void print(SimpleMemUsageReporter.Snapshot snap, java.lang.String message)
          Convenience printer with description
static void reset()
          Reinitialize
static SimpleMemUsageReporter.Snapshot snapshot()
          Takes a snapshot of the current heap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMemUsageReporter

public SimpleMemUsageReporter()
Method Detail

init

public static void init()
Initialize values


reset

public static void reset()
Reinitialize


snapshot

public static SimpleMemUsageReporter.Snapshot snapshot()
Takes a snapshot of the current heap

Returns:
- A Snapshot object that contains timestamps and heap values at the current time

print

public static void print(SimpleMemUsageReporter.Snapshot snap)
Convenience printer

Parameters:
snap - - the Snapshot to print to System.out

print

public static void print(SimpleMemUsageReporter.Snapshot snap,
                         java.lang.String message)
Convenience printer with description

Parameters:
snap - - the Snapshot to print to System.out
message - - the message to tack on for later identification

formatMemStat

public static java.lang.String formatMemStat(long value)
Static method for changing a long representing memory size to a human friendly string

Parameters:
value -
Returns:

formatTimeDiff

public static java.lang.String formatTimeDiff(long timeDiff)
Used to convert the time difference between snapshots to a human readable format

Parameters:
timeDiff -
Returns:

main

public static void main(java.lang.String[] args)
A simple test to make sure the output is sensible

Parameters:
args -

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.