Package org.jcsp.lang
Class SpuriousLog
java.lang.Object
org.jcsp.lang.SpuriousLog
This holds the log of spurious wakeups and early timeouts.
Description
The java.lang.Object.wait method sometimes returns spuriously - i.e. without being notify'd by another thread or interrupted or timed-out! This class is an optional (static) repository holding and reporting counts of any such spurious wakeups. JCSP handles all spurious wakeups cleanly.Some JVMs also timeout on calls of wait(timeout) early. This class enables the specification of how early will be acceptable to JCSP. ``Timeouts'' returned earlier than the set threshold are treated as spurious wakeups (i.e. the process is put back to sleep). Provision is also made for counting and reporting the accepted early timeouts.
To operate, this logging must first be switched on (start()
).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.private static int[]
private static int
private static final int
private static int
static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static final int
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
finish()
Finish logging of spurious wakeups.static long
This returns the allowed early timeout (in msecs).static int[]
Returns the counts of spurious wakeups so far.(package private) static void
Increment the count of early timeouts.static int
Returns the number of early timeouts accepted so far.static int
Returns the number of spurious wakeups so far.(package private) static void
record
(int x) Increment spurious wakeup counts.static String
report()
This returns a report on the counts of spurious wakeups and early timeouts so far.static void
setEarlyTimeout
(long earlyTimeout) This sets the allowed early timeout (in msecs).static void
start()
Start logging of spurious wakeups.
-
Field Details
-
One2OneChannelIntRead
public static final int One2OneChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2OneChannelIntWrite
public static final int One2OneChannelIntWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
One2OneChannelIntXRead
public static final int One2OneChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2OneChannelIntXWrite
public static final int One2OneChannelIntXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
One2OneChannelRead
public static final int One2OneChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2OneChannelWrite
public static final int One2OneChannelWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
One2OneChannelXRead
public static final int One2OneChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2OneChannelXWrite
public static final int One2OneChannelXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelIntRead
public static final int Any2OneChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelIntWrite
public static final int Any2OneChannelIntWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelIntXRead
public static final int Any2OneChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelIntXWrite
public static final int Any2OneChannelIntXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelRead
public static final int Any2OneChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelWrite
public static final int Any2OneChannelWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelXRead
public static final int Any2OneChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2OneChannelXWrite
public static final int Any2OneChannelXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelIntRead
public static final int One2AnyChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelIntWrite
public static final int One2AnyChannelIntWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelIntXRead
public static final int One2AnyChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelIntXWrite
public static final int One2AnyChannelIntXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelRead
public static final int One2AnyChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelWrite
public static final int One2AnyChannelWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelXRead
public static final int One2AnyChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
One2AnyChannelXWrite
public static final int One2AnyChannelXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelIntRead
public static final int Any2AnyChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelIntWrite
public static final int Any2AnyChannelIntWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelIntXRead
public static final int Any2AnyChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelIntXWrite
public static final int Any2AnyChannelIntXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelRead
public static final int Any2AnyChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelWrite
public static final int Any2AnyChannelWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelXRead
public static final int Any2AnyChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
Any2AnyChannelXWrite
public static final int Any2AnyChannelXWriteThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
AlternativeSelect
public static final int AlternativeSelectThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
AlternativeSelectWithTimeout
public static final int AlternativeSelectWithTimeoutThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
BarrierSync
public static final int BarrierSyncThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.- See Also:
-
BucketFallInto
public static final int BucketFallIntoThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
AltingBarrierCoordinateStartEnable
public static final int AltingBarrierCoordinateStartEnableThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.Note: this field is not operative in the current JCSP release. Spurious wakeups on AltingBarriers are handled correctly -- just not recorded.
- See Also:
-
StopRun
public static final int StopRunThis indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.- See Also:
-
nSpuriousWakeUpPlaces
private static final int nSpuriousWakeUpPlaces- See Also:
-
count
private static int[] count -
nSpuriousWakeUps
private static int nSpuriousWakeUps -
nEarlyTimeouts
private static int nEarlyTimeouts
-
-
Constructor Details
-
SpuriousLog
private SpuriousLog()
-
-
Method Details
-
start
public static void start()Start logging of spurious wakeups. This should be set before any concurrency is started. It should only be set once. There is no concurrency protection! -
finish
public static void finish()Finish logging of spurious wakeups. This should be set after any concurrency has finished. There is no concurrency protection! -
numberSpuriousWakeUps
public static int numberSpuriousWakeUps()Returns the number of spurious wakeups so far.- Returns:
- the number of spurious wakeups so far.
-
getSpuriousWakeUpCounts
public static int[] getSpuriousWakeUpCounts()Returns the counts of spurious wakeups so far. This array is indexed by the public constants in this class. Only a clone is returned.- Returns:
- the counts of spurious wakeups so far.
-
record
static void record(int x) Increment spurious wakeup counts.- Parameters:
x
- the operation that suffered the spurious wakeup.
-
setEarlyTimeout
public static void setEarlyTimeout(long earlyTimeout) This sets the allowed early timeout (in msecs). Some JVMs timeout on calls of wait(timeout) early - this specifies how early JCSP will tolerate. ``Timeouts'' returned earlier than the set threshold are treated as spurious wakeups (i.e. the process is put back to sleep).This should be set before any concurrency is started. It should only be set once. There is no concurrency protection!
- Parameters:
earlyTimeout
- the allowed early timeout (in msecs).
-
getEarlyTimeout
public static long getEarlyTimeout()This returns the allowed early timeout (in msecs).- Returns:
- the allowed early timeout (in msecs).
-
numberEarlyTimeouts
public static int numberEarlyTimeouts()Returns the number of early timeouts accepted so far.- Returns:
- the number of early timeouts accepted so far.
-
incEarlyTimeouts
static void incEarlyTimeouts()Increment the count of early timeouts. -
report
This returns a report on the counts of spurious wakeups and early timeouts so far. A breakdown of spurious wakeup counts is given only if there are some.- Returns:
- the report.
-