public class GrowableCoverageRecorder extends BaseCoverageRecorder
CoverageRecorder which can grow its capacity to record coverage. This is necessary
where the original Clover database is unavailable due to various deployment scenarios
and Clover should make best efforts to record coverage.
This class will emit proxy CoverageRecorders from withCapacityFor(int) which can track
enough coverage required at the point when they were requested (normally when a Clovered class is first loaded).
If more coverage needs to be tracked a subsequent call to withCapacityFor(int) should be made for a new proxy
which satisfies the new requirements. A call to withCapacityFor(int) on a proxy will, if the proxy
cannot support the required number of elements, will redirect to the underlying GrowableCoverageRecorder
which will return a sufficenly large proxy (having grown the underlying CoverageMatrix in a thread safe
manner).
Proxies and the original GrowableCoverageRecorder share coverage by sharing int[] sections of the total
logical coverage array (which in essence becomes an int[][] ie a matrix). The master matrix may grow but because the
original int[] objects remain in use and shared across all subsequent proxies the total coverage is shared in a relatively
thread safe fashion (note: we still suffer the elements[i]++ MT problem).| Modifier and Type | Class and Description |
|---|---|
static class |
GrowableCoverageRecorder.FixedProxy
A lightweight proxy which provides just enough coverage capacity
for the class that asked for it but delegates to the original
GrowableCoverageRecorder for all other functions.
|
activeFlusher, alternateRecName, dbName, dbVersion, flushInterval, flushNeeded, lastFlush, recName, shutdownFlusher, testCoverage, useAlternate, writeStrategyDISABLE_SHUTDOWNHOOK_MASK, DISABLE_SLICE_FLUSHING_MASK, FLUSH_INTERVAL_MASK, FLUSHPOLICY_DIRECTED, FLUSHPOLICY_INTERVAL, FLUSHPOLICY_MASK, FLUSHPOLICY_THREADED, USE_CURRENT_THREADGROUP_MASK| Modifier and Type | Method and Description |
|---|---|
CloverBitSet |
compareCoverageWith(CoverageSnapshot before) |
CloverBitSet |
createEmptyHitsMask() |
static CoverageRecorder |
createFor(String dbName,
long dbVersion,
long cfgbits,
int maxNumElements)
Factory method.
|
CoverageSnapshot |
getCoverageSnapshot() |
int |
iget(int index) |
void |
inc(int index)
Increment slot at index
|
String |
toString() |
CoverageRecorder |
withCapacityFor(int maxNumElements)
Returns an instance that *may* support recording the number of elements requested (throw growth)
else accepts (but harmlessly) discards recording for elements that can't be accepted.
|
protected String |
write()
Writes coverage data to disk
|
chooseRecordingName, flush, flushNeeded, forceFlush, getDbName, getDbVersion, getRecordingName, getShutdownFlusher, globalSliceEnd, globalSliceEnd, globalSliceStart, globalSliceStart, maybeFlush, sliceEnd, sliceStart, startRun, writegetConfigBits, rethrowpublic static CoverageRecorder createFor(String dbName, long dbVersion, long cfgbits, int maxNumElements)
protected String write() throws IOException
BaseCoverageRecorderwrite in class BaseCoverageRecorderIOExceptionpublic CloverBitSet compareCoverageWith(CoverageSnapshot before)
compareCoverageWith in class CoverageRecorderpublic CloverBitSet createEmptyHitsMask()
createEmptyHitsMask in class CoverageRecorderpublic int iget(int index)
iget in class BaseCoverageRecorderpublic void inc(int index)
BaseCoverageRecorderinc in class BaseCoverageRecorderpublic CoverageRecorder withCapacityFor(int maxNumElements)
CoverageRecorderwithCapacityFor in class CoverageRecorderpublic CoverageSnapshot getCoverageSnapshot()
getCoverageSnapshot in class CoverageRecorderCopyright © 2023 OpenClover.org. All rights reserved.