Package org.jcsp.lang
Class SpuriousLog
- java.lang.Object
-
- org.jcsp.lang.SpuriousLog
-
public class SpuriousLog extends java.lang.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()
).
-
-
Field Summary
Fields Modifier and Type Field Description static int
AlternativeSelect
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
AlternativeSelectWithTimeout
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
AltingBarrierCoordinateStartEnable
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2AnyChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2AnyChannelIntWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
Any2AnyChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2AnyChannelIntXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
Any2AnyChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2AnyChannelWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
Any2AnyChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2AnyChannelXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
Any2OneChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2OneChannelIntWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
Any2OneChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2OneChannelIntXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
Any2OneChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2OneChannelWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
Any2OneChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
Any2OneChannelXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
BarrierSync
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
BucketFallInto
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.private static int[]
count
private static int
nEarlyTimeouts
private static int
nSpuriousWakeUpPlaces
private static int
nSpuriousWakeUps
static int
One2AnyChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2AnyChannelIntWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
One2AnyChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2AnyChannelIntXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
One2AnyChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2AnyChannelWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
One2AnyChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2AnyChannelXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
One2OneChannelIntRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2OneChannelIntWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
One2OneChannelIntXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2OneChannelIntXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
One2OneChannelRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2OneChannelWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
One2OneChannelXRead
This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()
), indicating the class and operation that suffered.static int
One2OneChannelXWrite
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.static int
StopRun
This indexes the counts of spurious wakeups (report()
), indicating the class and operation that suffered.
-
Constructor Summary
Constructors Modifier Constructor Description private
SpuriousLog()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
finish()
Finish logging of spurious wakeups.static long
getEarlyTimeout()
This returns the allowed early timeout (in msecs).static int[]
getSpuriousWakeUpCounts()
Returns the counts of spurious wakeups so far.(package private) static void
incEarlyTimeouts()
Increment the count of early timeouts.static int
numberEarlyTimeouts()
Returns the number of early timeouts accepted so far.static int
numberSpuriousWakeUps()
Returns the number of spurious wakeups so far.(package private) static void
record(int x)
Increment spurious wakeup counts.static java.lang.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 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
-
nSpuriousWakeUpPlaces
private static final int nSpuriousWakeUpPlaces
- See Also:
- Constant Field Values
-
count
private static int[] count
-
nSpuriousWakeUps
private static int nSpuriousWakeUps
-
nEarlyTimeouts
private static int nEarlyTimeouts
-
-
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.
-
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
public static java.lang.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.
-
-