Skip to content

Commit ad36634

Browse files
committed
Added Histogram text
1 parent c2fa964 commit ad36634

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

docs/manual.adoc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,3 +799,33 @@ There are therefore two ways of getting the number of entries in a bucket:
799799
If the bucket does not exist then each of these methods throws IllegalArgumentException.
800800

801801
It is possible to output the contents of the histogram to standard output using the print()method.
802+
803+
==== Histogram
804+
805+
The problem with the PrecisionHistogram class is that it can use up a lot of system resources, especially over the course of a long simulation. Histogram attempts to alleviate this by presenting a histogram which is less accurate, but consumes less resources. Instead of maintaining a bucket for each individual value, it keeps a fixed number of buckets. Initially each bucket will store separate values as in the PrecisionHistogram, but when the number of required buckets would exceed the specified maximum number it merges pairs of buckets, thus reducing their total. The policy used when merging buckets it set on a per instance basis when created. Current policies are:
806+
807+
- ACCUMULATE: create a new bucket with the same name as the largest of the two buckets, and it has the sum of the two old bucket entries as its entry number.
808+
809+
- MEAN: create a new bucket with the name as the mean of the two old buckets, and it has the sum of the two old bucket entries as its entry number.
810+
811+
- MAX: create a new bucket with the name as the largest of the two buckets, and it has the same number of entries.
812+
- MIN: create a new bucket with the name as the smallest of the two old buckets, and it has the same number of entries.
813+
814+
----
815+
public class Histogram extends PrecisionHistogram
816+
{
817+
public Histogram (long maxIndex, int mergeChoice); public Histogram (long maxIndex);
818+
819+
public void setValue (double value) throws IllegalArgumentException;
820+
821+
public boolean saveState (String fileName) throws IOException;
822+
public boolean saveState (DataOutputStream oFile) throws IOException;
823+
824+
public boolean restoreState (String fileName) throws FileNotFoundException, IOException;
825+
public boolean restoreState (DataInputStream iFile) throws IOException;
826+
827+
public void print ();
828+
};
829+
----
830+
831+
When an instance of Histogram is created, the maximum number of allowed buckets must be specified. The merging algorithm can also be provided, with the default being the MEAN policy.

0 commit comments

Comments
 (0)