KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > services > cache > CacheStat


1 /*
2
3    Derby - Class org.apache.derby.impl.services.cache.CacheStat
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.services.cache;
23
24 import org.apache.derby.iapi.services.sanity.SanityManager;
25
26 class CacheStat {
27
28     /*
29     ** Fields
30     */

31     protected int findHit;
32     protected int findMiss;
33     protected int findFault;
34     protected int findCachedHit;
35     protected int findCachedMiss;
36     protected int create;
37     protected int ageOut;
38     protected int cleanAll;
39     protected int remove;
40     protected long initialSize;
41     protected long maxSize;
42     protected long currentSize;
43
44     protected long[] data;
45
46     public long[] getStats()
47     {
48         if (data == null)
49             data = new long[14];
50
51         data[0] = findHit + findMiss;
52         data[1] = findHit;
53         data[2] = findMiss;
54         data[3] = findFault;
55         data[4] = findCachedHit + findCachedMiss;
56         data[5] = findCachedHit;
57         data[6] = findCachedMiss;
58         data[7] = create;
59         data[8] = ageOut;
60         data[9] = cleanAll;
61         data[10] = remove;
62         data[11] = initialSize;
63         data[12] = maxSize;
64         data[13] = currentSize;
65
66         return data;
67     }
68
69     public void reset()
70     {
71         findHit = 0;
72         findMiss = 0;
73         findFault = 0;
74         findCachedHit = 0;
75         findCachedMiss = 0;
76         create = 0;
77         ageOut = 0;
78         cleanAll = 0;
79         remove = 0;
80     }
81 }
82
Popular Tags