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 Details

    • One2OneChannelIntRead

      public static final int One2OneChannelIntRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2OneChannelIntWrite

      public static final int One2OneChannelIntWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • One2OneChannelIntXRead

      public static final int One2OneChannelIntXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2OneChannelIntXWrite

      public static final int One2OneChannelIntXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • One2OneChannelRead

      public static final int One2OneChannelRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2OneChannelWrite

      public static final int One2OneChannelWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • One2OneChannelXRead

      public static final int One2OneChannelXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2OneChannelXWrite

      public static final int One2OneChannelXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelIntRead

      public static final int Any2OneChannelIntRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelIntWrite

      public static final int Any2OneChannelIntWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelIntXRead

      public static final int Any2OneChannelIntXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelIntXWrite

      public static final int Any2OneChannelIntXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelRead

      public static final int Any2OneChannelRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelWrite

      public static final int Any2OneChannelWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelXRead

      public static final int Any2OneChannelXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2OneChannelXWrite

      public static final int Any2OneChannelXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelIntRead

      public static final int One2AnyChannelIntRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelIntWrite

      public static final int One2AnyChannelIntWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelIntXRead

      public static final int One2AnyChannelIntXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelIntXWrite

      public static final int One2AnyChannelIntXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelRead

      public static final int One2AnyChannelRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelWrite

      public static final int One2AnyChannelWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelXRead

      public static final int One2AnyChannelXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • One2AnyChannelXWrite

      public static final int One2AnyChannelXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelIntRead

      public static final int Any2AnyChannelIntRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelIntWrite

      public static final int Any2AnyChannelIntWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelIntXRead

      public static final int Any2AnyChannelIntXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelIntXWrite

      public static final int Any2AnyChannelIntXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelRead

      public static final int Any2AnyChannelRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelWrite

      public static final int Any2AnyChannelWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelXRead

      public static final int Any2AnyChannelXRead
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • Any2AnyChannelXWrite

      public static final int Any2AnyChannelXWrite
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • AlternativeSelect

      public static final int AlternativeSelect
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • AlternativeSelectWithTimeout

      public static final int AlternativeSelectWithTimeout
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • BarrierSync

      public static final int BarrierSync
      This indexes the counts of spurious wakeups (getSpuriousWakeUpCounts()), indicating the class and operation that suffered.
      See Also:
    • BucketFallInto

      public static final int BucketFallInto
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
    • 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:
    • StopRun

      public static final int StopRun
      This indexes the counts of spurious wakeups (report()), indicating the class and operation that suffered.
      See Also:
  • 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.
    • 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.