Package org.jcsp.lang
Class SpuriousLog
- java.lang.Object
-
- org.jcsp.lang.SpuriousLog
-
public class SpuriousLog extends Object
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()).- Author:
- P.H. Welch
-
-
Field Summary
Fields Modifier and Type Field Description static intAlternativeSelectThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAlternativeSelectWithTimeoutThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAltingBarrierCoordinateStartEnableThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2AnyChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2AnyChannelIntWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAny2AnyChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2AnyChannelIntXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAny2AnyChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2AnyChannelWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAny2AnyChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2AnyChannelXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAny2OneChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2OneChannelIntWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAny2OneChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2OneChannelIntXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAny2OneChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2OneChannelWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intAny2OneChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intAny2OneChannelXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intBarrierSyncThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intBucketFallIntoThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2AnyChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2AnyChannelIntWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2AnyChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2AnyChannelIntXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2AnyChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2AnyChannelWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2AnyChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2AnyChannelXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2OneChannelIntReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2OneChannelIntWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2OneChannelIntXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2OneChannelIntXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2OneChannelReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2OneChannelWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intOne2OneChannelXReadThis indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.static intOne2OneChannelXWriteThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.static intStopRunThis indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidfinish()Finish logging of spurious wakeups.static longgetEarlyTimeout()This returns the allowed early timeout (in msecs).static int[]getSpuriousWakeUpCounts()Returns the counts of spurious wakeups so far.static intnumberEarlyTimeouts()Returns the number of early timeouts accepted so far.static intnumberSpuriousWakeUps()Returns the number of spurious wakeups so far.static Stringreport()This returns a report on the counts of spurious wakeups and early timeouts so far.static voidsetEarlyTimeout(long earlyTimeout)This sets the allowed early timeout (in msecs).static voidstart()Start logging of spurious wakeups.
-
-
-
Field Detail
-
One2OneChannelIntRead
public static final int One2OneChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2OneChannelIntWrite
public static final int One2OneChannelIntWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2OneChannelIntXRead
public static final int One2OneChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2OneChannelIntXWrite
public static final int One2OneChannelIntXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2OneChannelRead
public static final int One2OneChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2OneChannelWrite
public static final int One2OneChannelWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2OneChannelXRead
public static final int One2OneChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2OneChannelXWrite
public static final int One2OneChannelXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelIntRead
public static final int Any2OneChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelIntWrite
public static final int Any2OneChannelIntWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelIntXRead
public static final int Any2OneChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelIntXWrite
public static final int Any2OneChannelIntXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelRead
public static final int Any2OneChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelWrite
public static final int Any2OneChannelWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelXRead
public static final int Any2OneChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2OneChannelXWrite
public static final int Any2OneChannelXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelIntRead
public static final int One2AnyChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelIntWrite
public static final int One2AnyChannelIntWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelIntXRead
public static final int One2AnyChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelIntXWrite
public static final int One2AnyChannelIntXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelRead
public static final int One2AnyChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelWrite
public static final int One2AnyChannelWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelXRead
public static final int One2AnyChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
One2AnyChannelXWrite
public static final int One2AnyChannelXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelIntRead
public static final int Any2AnyChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelIntWrite
public static final int Any2AnyChannelIntWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelIntXRead
public static final int Any2AnyChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelIntXWrite
public static final int Any2AnyChannelIntXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelRead
public static final int Any2AnyChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelWrite
public static final int Any2AnyChannelWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelXRead
public static final int Any2AnyChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
Any2AnyChannelXWrite
public static final int Any2AnyChannelXWrite
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
AlternativeSelect
public static final int AlternativeSelect
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
AlternativeSelectWithTimeout
public static final int AlternativeSelectWithTimeout
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
BarrierSync
public static final int BarrierSync
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
BucketFallInto
public static final int BucketFallInto
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
AltingBarrierCoordinateStartEnable
public static final int AltingBarrierCoordinateStartEnable
This 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:
- Constant Field Values
-
StopRun
public static final int StopRun
This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.- See Also:
- Constant Field Values
-
-
Method Detail
-
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.
-
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.
-
report
public static String 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.
-
-