com.ricebridge.xmlman
Class Stats

java.lang.Object
  extended bycom.ricebridge.xmlman.Stats
Direct Known Subclasses:
MutableStats

public abstract class Stats
extends Object

Access statistics about the current load or save operation.

You can get the current statistics object by calling the XmlManager.getStats() method. XML Manager collects a number of statistics about the load or save operation, and you can access them using the methods of this class. The statistics collected are:

The Stats object contains the statistics for the most recent load or save operation. Each operation creates a new object, so you can continue to use existing objects for as long as you like.

When running the load or save process in the background in a separate thread, you can still use the Stats object, as it is updated dynamically. This means you can monitor the load or save operation and use this to provide progress reporting.

To get a quick overview of the statistics as a String, use the getSummary() method.

See Also:
XmlManager, XmlSpec

Field Summary
protected  long iBadRecords
          Count of bad records (does not include bad records due to XML syntax errors).
protected  Date iEndDate
          End time of the load or save process.
protected  Date iStartDate
          Start time of the load or save process.
protected  long iTotalRecords
          Count of total records, including bad records.
 
Constructor Summary
Stats()
          Create a new Stats object.
 
Method Summary
protected  void clear()
          Zero all the counters.
 double getAverageTimePerRecordInSeconds()
          Get the average time taken to process each record in seconds.
 Date getEndDate()
          Get the Date at which processing ended.
 Date getStartDate()
          Get the Date at which processing started.
 String getSummary()
          Get a summary String containing the statistics of the previous or running operation.
 long getTimeTaken()
          Get the total time in milliseconds taken to process all records.
 double getTimeTakenInSeconds()
          Get the total time in seconds taken to process all lines.
 long getTotalBadRecords()
          Get the number of bad data records when loading or saving.
 long getTotalRecords()
          Get the number of data records loaded or saved.
 String toString()
          Return the summary string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

iTotalRecords

protected long iTotalRecords
Count of total records, including bad records.


iBadRecords

protected long iBadRecords
Count of bad records (does not include bad records due to XML syntax errors).


iStartDate

protected Date iStartDate
Start time of the load or save process.


iEndDate

protected Date iEndDate
End time of the load or save process.

Constructor Detail

Stats

public Stats()
Create a new Stats object.

Method Detail

getTotalRecords

public long getTotalRecords()
Get the number of data records loaded or saved.

If the load or save process is running in a separate Thread (see XmlSpec.setBackground(boolean)), this method returns the number of records currently processed.

Note: the record count includes the number of bad records found.

See Also:
getTotalBadRecords(), getSummary(), BadRecord

getTotalBadRecords

public long getTotalBadRecords()
Get the number of bad data records when loading or saving.

If the load or save process is running in a separate Thread (see XmlSpec.setBackground(boolean)), this method returns the number of bad records currently processed.

When the XmlSpec.setIgnoreBadRecords(boolean) property is true, this method returns a count of all bad records seen. When false, it has a value of at most one (as processing halts).

Note: the getTotalRecords() method includes the number of bad records found.

See Also:
getTotalRecords(), getSummary(), BadRecord

getStartDate

public Date getStartDate()
Get the Date at which processing started.

See Also:
getSummary()

getEndDate

public Date getEndDate()
Get the Date at which processing ended.

See Also:
getSummary()

getAverageTimePerRecordInSeconds

public double getAverageTimePerRecordInSeconds()
Get the average time taken to process each record in seconds.

This provides a running average if the process is running in the background.

See Also:
getSummary()

getTimeTaken

public long getTimeTaken()
Get the total time in milliseconds taken to process all records.

This provides a running total if the process is running in the background.

See Also:
getSummary()

getTimeTakenInSeconds

public double getTimeTakenInSeconds()
Get the total time in seconds taken to process all lines.

This provides a running total if the process is running in the background.

See Also:
getSummary()

getSummary

public String getSummary()
Get a summary String containing the statistics of the previous or running operation.

An example result String is:

[XML:Summary:fin=true:recs=22:bad=0:avgsec=0.0005:totalsec=0.01: \
    start=20051013061519:end=20051013061519]
The result String is designed for machine and human readability and has the general format:
[XML:Summary:fin={boolean}:recs={long}:bad={long}:avgsec={0.####}:totalsec={0.####}: \
    start={yyyyMMddhhmmss}:end={yyyyMMddhhmmss}]

See Also:
getTotalRecords(), getTotalBadRecords(), getTimeTaken(), getTimeTakenInSeconds(), getAverageTimePerRecordInSeconds(), getStartDate(), getEndDate()

toString

public String toString()
Return the summary string.

See Also:
getSummary()

clear

protected void clear()
Zero all the counters.



Copyright © 2004-2005 Ricebridge