cz.vutbr.fit.racedetector
Class RaceDetector

java.lang.Object
  extended by cz.vutbr.fit.racedetector.RaceDetector

public class RaceDetector
extends java.lang.Object

The main class of the race detector. It takes care of initialization and finalization phase of the detection and implements ConTest listeners. It contains also some common global methods and fields which are used by other classes.

See package description for more info.

Author:
zdenek

Nested Class Summary
static class RaceDetector.DetectorImplementation
          Available implementations of race detecting algorithms.
static class RaceDetector.HealingMethod
          Methods of healing: THREADS - Method based on the utilization of other processors (cores) in the system.
static class RaceDetector.Operation
          Read operation.
 
Field Summary
protected static AtomicityCollection atomicity
           
(package private) static boolean ATOMICITY
          Turn on the atomicity.
static java.lang.String ATOMICITY_FILE
          file from which the setting will be taken
(package private) static boolean ATOMRACE_IMMHEAL
          Turn AtomRace to try avoid even the first occurence of the race.
(package private) static boolean ATOMRACE_LEARN
          Turn AtomRace to work in the first "learning" phase.
protected static Detector detector
          Instance of used detector.
protected static RaceDetector.DetectorImplementation DETECTOR
          Algorithm that will be used for race detecting.
(package private) static boolean HEAL_VARIABLES
          Enable the usage of a list of variables that should be healed from the beginning.
(package private) static boolean HEALING
          Enable the healing feature.
static RaceDetector.HealingMethod HEALING_METHOD
          Method that is used to heal the Race.
static java.lang.String HEALVAR_FILE
          file from which the variables which should be healed immediately are loaded
(package private) static boolean LOCK_DETERMINE
          Enable Lock determination feature.
(package private) static boolean NOISE
          Enable the usage of noise injecting mechanism.
(package private) static int NOISE_FREQUENCY
          Frequency of noise injected by the RaceDetector in promile (0 - 1000).
(package private) static boolean NOISE_PROGLOC
          Enable the usage of a list of program locations that should be focused by noise injecting mechanism.
(package private) static boolean NOISE_RANDOM
          Enable the usage of random noise injecting mechanism.
(package private) static boolean NOISE_VARIABLES
          Enable the usage of a list of variablse that should be focused by noise injecting mechanism.
static java.lang.String NOISELOC_FILE
          file from which the program location which should be noised are loaded
static java.lang.String NOISEVAR_FILE
          file from which the variables which should be noised are loaded
(package private) static boolean OMIT_VARIABLES
          Enable the usage of a list of variables that should not be analysed.
static java.lang.String OMITVAR_FILE
          file from which the variables which should not be analysed are loaded
(package private) static boolean OWNER_TRANSFER
          It is common that initialization and use of objects are logically separated.
static java.lang.String PROPERTIES_FILE
          file from which the setting will be taken
static java.lang.String RD_DIRECTORY
          directory name with the race detector input files
static java.lang.String VERSION
          A string denoting the current version.
 
Constructor Summary
RaceDetector(RaceDetector.DetectorImplementation detectorType, Detector detectorInstance)
          Main constructor called by ConTest.
 
Method Summary
protected static java.lang.String getProperVarName(java.lang.Object instance, java.lang.String varName)
          Returns string representation of the variable - without instance (instance is needed for array processing).
protected static java.lang.String getVarIdentifier(java.lang.Object instance, java.lang.String varName)
          Returns unique string representation of a variable.
static void printDebug(java.lang.String text)
          Used for printing debug info.
protected static void printWarning(java.lang.String varIdentifier, java.lang.String raceDescription)
          Used for printing warnings.
protected static void printWarning(java.lang.String varIdentifier, java.lang.Thread thread, java.lang.String programLocation, java.lang.String details)
          Used for printing warnings.
static void setDetectorType(Detector det)
          Set detector -(Eraser / AtomRace).
static void setRunAsFail()
          In the case of usage the AtomRace this method marks the run as the run where the error has been detected.
protected static void updateArrayInfo(java.lang.Object instance, java.lang.Object value, int index)
          Collect the information about array.
protected static void updateArrayInfo(java.lang.Object instance, java.lang.Object value, java.lang.String varName)
          Collect the information about array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
A string denoting the current version. Used in information outputs and in Eclipse plug-in.

See Also:
Constant Field Values

PROPERTIES_FILE

public static final java.lang.String PROPERTIES_FILE
file from which the setting will be taken

See Also:
Constant Field Values

RD_DIRECTORY

public static final java.lang.String RD_DIRECTORY
directory name with the race detector input files

See Also:
Constant Field Values

ATOMICITY_FILE

public static final java.lang.String ATOMICITY_FILE
file from which the setting will be taken

See Also:
Constant Field Values

OMITVAR_FILE

public static final java.lang.String OMITVAR_FILE
file from which the variables which should not be analysed are loaded

See Also:
Constant Field Values

HEALVAR_FILE

public static final java.lang.String HEALVAR_FILE
file from which the variables which should be healed immediately are loaded

See Also:
Constant Field Values

NOISEVAR_FILE

public static final java.lang.String NOISEVAR_FILE
file from which the variables which should be noised are loaded

See Also:
Constant Field Values

NOISELOC_FILE

public static final java.lang.String NOISELOC_FILE
file from which the program location which should be noised are loaded

See Also:
Constant Field Values

OMIT_VARIABLES

static boolean OMIT_VARIABLES
Enable the usage of a list of variables that should not be analysed. The intention is to specify variables which produced false alarms in the previous executions. The alarms for this variables are not produced any more.


HEAL_VARIABLES

static boolean HEAL_VARIABLES
Enable the usage of a list of variables that should be healed from the beginning. All the instances of variables names given in a file will be healed as the race has been already detected on them. In this case, the healing efficiency can be tested.


NOISE

static boolean NOISE
Enable the usage of noise injecting mechanism.


NOISE_RANDOM

static boolean NOISE_RANDOM
Enable the usage of random noise injecting mechanism. In such case, a noise will be inserted in the middle of randomly chosen section that should be atomic with the intention to increase the probability of race manifestation.


NOISE_VARIABLES

static boolean NOISE_VARIABLES
Enable the usage of a list of variablse that should be focused by noise injecting mechanism. In such case, a noise will be inserted in the middle of section that should be atomic with the intention to increase the probability of race manifestation.


NOISE_PROGLOC

static boolean NOISE_PROGLOC
Enable the usage of a list of program locations that should be focused by noise injecting mechanism. In such case, a noise will be inserted in the middle of section that should be atomic with the intention to increase the probability of race manifestation.


NOISE_FREQUENCY

static int NOISE_FREQUENCY
Frequency of noise injected by the RaceDetector in promile (0 - 1000).


OWNER_TRANSFER

static boolean OWNER_TRANSFER
It is common that initialization and use of objects are logically separated. In such cases second owner should not be burnered with access checks. To allow this feature set this true. This feature can decrease the count of false alarms. In most cases it is save to have it enabled.


LOCK_DETERMINE

static boolean LOCK_DETERMINE
Enable Lock determination feature. Algorithm tries to determine which lock should be locked and produces a suggestion to the programmer.


ATOMRACE_LEARN

static boolean ATOMRACE_LEARN
Turn AtomRace to work in the first "learning" phase. In this phase where AtomRace only identify atomicities which were broken during the execution and these save to the file and prepare for removing from the set of atomicities.

Otherwise it works in "detection" phase.


ATOMRACE_IMMHEAL

static boolean ATOMRACE_IMMHEAL
Turn AtomRace to try avoid even the first occurence of the race. The algorithm does not know at the time of suspected access if it can cause a race. Therefore it blocks the suspected access till the threads which are in the critical section does not leave it.


ATOMICITY

static boolean ATOMICITY
Turn on the atomicity. This causes that the atomicity xml will be loaded and prepared for use. Atomicity is enabled when healing or AtomRace is specified.


HEALING

static boolean HEALING
Enable the healing feature. (ATOMICITY must be also enabled.)


HEALING_METHOD

public static RaceDetector.HealingMethod HEALING_METHOD
Method that is used to heal the Race. (HEALING and ATOMICITY must be enabled.)


DETECTOR

protected static RaceDetector.DetectorImplementation DETECTOR
Algorithm that will be used for race detecting.


detector

protected static Detector detector
Instance of used detector.


atomicity

protected static final AtomicityCollection atomicity
Constructor Detail

RaceDetector

public RaceDetector(RaceDetector.DetectorImplementation detectorType,
                    Detector detectorInstance)
Main constructor called by ConTest. Method open the log file and register java shutdown hook for the RaceDetector. It is able to execute things before the start of instrumented program and prepare hook for executing things at the end of instrumented program. Properties from KingProperties file is read and set accordingly.

Method Detail

setRunAsFail

public static void setRunAsFail()
In the case of usage the AtomRace this method marks the run as the run where the error has been detected.


setDetectorType

public static void setDetectorType(Detector det)
Set detector -(Eraser / AtomRace). Do not use this method - it is only for testing purposes. Setting of detector is done by processing RDKingProperties file.


getVarIdentifier

protected static java.lang.String getVarIdentifier(java.lang.Object instance,
                                                   java.lang.String varName)
Returns unique string representation of a variable. The identityHashCode method returns the same value for this string if it represents the same variable.


getProperVarName

protected static java.lang.String getProperVarName(java.lang.Object instance,
                                                   java.lang.String varName)
Returns string representation of the variable - without instance (instance is needed for array processing).


updateArrayInfo

protected static void updateArrayInfo(java.lang.Object instance,
                                      java.lang.Object value,
                                      java.lang.String varName)
Collect the information about array. This information is used for getProperVarName.


updateArrayInfo

protected static void updateArrayInfo(java.lang.Object instance,
                                      java.lang.Object value,
                                      int index)
Collect the information about array. This information is used for getProperVarName. For second and deeper level of arrays.


printWarning

protected static void printWarning(java.lang.String varIdentifier,
                                   java.lang.Thread thread,
                                   java.lang.String programLocation,
                                   java.lang.String details)
Used for printing warnings.


printWarning

protected static void printWarning(java.lang.String varIdentifier,
                                   java.lang.String raceDescription)
Used for printing warnings.


printDebug

public static void printDebug(java.lang.String text)
Used for printing debug info.