public class GbjCacheStats extends GbjGciCacheStats
| name | The name of the process generating these stats |
| pid | The process ID |
| sid | The session ID |
| type | An integer representing the type of GS process |
| stats32 | An int[] array for holding the 32-bit stats |
| stats64 | A long[] array for holding the 64-bit stats |
Useful behavior defined in GbjCacheStats includes:
| attach | Attach to a particular shared page cache |
| sample | Take a sample of all cache stats for all processes associated with this shared page cache |
| fetch | Fetch the batch of stats associated with a particular GS process that were taken during a prior sample() |
| get | Get the single stat value associated with the given name |
| detach | Detach from the shared page cache |
The following is a code snippet demonstrating a typical calling sequence for
using these functions:
// Initialize Pid tracking lists
List<Long> newPids = new ArrayList<Long>(maxProcs);
List<Long> oldPids = new ArrayList<Long>(maxProcs);
List<Long> deadPids = new ArrayList<Long>(maxProcs);
// Attach cache
int maxProcs = GbjCacheStats.attach("StoneName");
// Take first sample
GbjCacheStats.sample(newPids, oldPids, deadPids);
// Get stat from a process of interest
GbjCacheStats myStats = GbjCacheStats.fetch(PidOfInterest);
long stat = myStats.get("StatOfInterest");
// Loop over time and update stat
do {
// sleep for some time interval..
Thread.currentThread().sleep(SleepTimeInMilliseconds);
// Take next sample
GbjCacheStats.sample(newPids, oldPids, deadPids);
// Update our stat info from new sample
myStats.update();
stat = myStats.get("StatOfInterest");
} while (true);
// when done, detach the cache
GbjCacheStats.detach();
Modifier and Type | Class and Description |
---|---|
static class |
GbjCacheStats.CacheType
A representation for various types of GS processes
|
name, pid, sid, stats32, stats64, type, TYPE_APP, TYPE_GEM, TYPE_PGSVR, TYPE_SPCMONITOR, TYPE_STATMON, TYPE_STONE, TYPE_SYSTEM, TYPE_UNASSIGNED
Constructor and Description |
---|
GbjCacheStats(long p)
Establish a set of cache stats associated with this process ID
|
Modifier and Type | Method and Description |
---|---|
static int |
attach(String stnName)
Attach to a particular shared page cache
|
String |
cacheTypeString()
Return the type of cache stat: spcmon, stone, pgsvr, gem
|
static void |
detach()
Detach from this shared page cache
|
static GbjCacheStats |
fetch(long pid)
Return the GbjCacheStats associated with this process ID taken during a
prior sample( ).
|
long |
get(String name)
Return the value of the stat with this given name
|
static void |
sample(List<Long> newPids,
List<Long> oldPids,
List<Long> deadPids)
Sample all the cache statistics associated with this stone/shared page cache.
|
String[] |
statNames()
Return the list of stat names associated with this stat
|
void |
update()
Update (refresh) the information for this cache stat with the
data taken from the last sample()
|
public GbjCacheStats(long p)
public String cacheTypeString()
public static int attach(String stnName)
public static void detach()
public static void sample(List<Long> newPids, List<Long> oldPids, List<Long> deadPids)
newPids - processes that have appeared since the last sample
oldPids - processes which existed during the last sample
deadPids - processes which have disappeared since the last sample
These lists should be initialized using:
new ArrayList<Long>(maxProcs)
Where maxProcs is the maximum number of processes returned by the GbjGciStats.attach() call.
Note that the first time this method is called, *all* processes will be returned as newPids with oldPids and deadPids empty.
public void update()
public static GbjCacheStats fetch(long pid)
public long get(String name) throws IllegalArgumentException
IllegalArgumentException
public String[] statNames()