Mercurial > hg > blitz_condensed
annotate src/org/dancres/blitz/stats/StoreStat.java @ 33:0b9265358617
Added tag 2.1.1 for changeset a77f0a9ed93c
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 12 Jun 2010 10:52:10 +0100 |
parents | b7e52953b7a6 |
children |
rev | line source |
---|---|
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
1 package org.dancres.blitz.stats; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
2 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
3 /** |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
4 */ |
22
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
5 public class StoreStat implements Stat { |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
6 private static final long _minimalFree; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
7 |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
8 private long _id; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
9 private String _type; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
10 private String[] _titles; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
11 private long[] _missed; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
12 private long[] _deleted; |
22
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
13 private boolean _safe; |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
14 |
22
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
15 private int _activeCache; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
16 private int _totalCache; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
17 private long _free; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
18 private long _max; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
19 |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
20 static { |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
21 _minimalFree = Runtime.getRuntime().maxMemory() / 5; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
22 } |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
23 |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
24 public StoreStat(long anId, String aType, |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
25 String[] aTitles, |
22
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
26 long[] aMisses, long[] aDeld, int anActiveCacheSize, int aCacheSize) { |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
27 _id = anId; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
28 _type = aType; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
29 _titles = aTitles; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
30 _missed = aMisses; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
31 _deleted = aDeld; |
22
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
32 |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
33 _activeCache = anActiveCacheSize; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
34 _totalCache = aCacheSize; |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
35 _free = Runtime.getRuntime().freeMemory(); |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
36 _max = Runtime.getRuntime().maxMemory(); |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
37 |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
38 _safe = (anActiveCacheSize == aCacheSize) && |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
39 (Runtime.getRuntime().freeMemory() >= _minimalFree); |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
40 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
41 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
42 public long getId() { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
43 return _id; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
44 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
45 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
46 public String toString() { |
22
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
47 StringBuffer myBuffer = new StringBuffer("Store: " + _type); |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
48 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
49 for (int i = 0; i < _titles.length; i++) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
50 myBuffer.append(" "); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
51 myBuffer.append(_titles[i]); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
52 myBuffer.append(" miss: "); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
53 myBuffer.append(_missed[i]); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
54 myBuffer.append(" deld: "); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
55 myBuffer.append(_deleted[i]); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
56 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
57 |
22
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
58 myBuffer.append(" sustainable: "); |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
59 myBuffer.append(_safe); |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
60 myBuffer.append(" (" + _activeCache + ", " + _totalCache + ", " + _free + ", " + _max + ")"); |
b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
61 |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
62 return myBuffer.toString(); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
63 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
64 } |