org.opensolaris.os.dtrace
Class UserSymbolRecord

java.lang.Object
  extended by org.opensolaris.os.dtrace.UserSymbolRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<UserSymbolRecord>, Record, SymbolValueRecord, ValueRecord

public final class UserSymbolRecord
extends java.lang.Object
implements SymbolValueRecord, java.io.Serializable, java.lang.Comparable<UserSymbolRecord>

A value generated by the DTrace umod(), ufunc(), or usym() action used to lookup the symbol associated with a user address.

Immutable. Supports persistence using XMLEncoder.

See Also:
Serialized Form

Nested Class Summary
static class UserSymbolRecord.Value
          The composite value of a symbol's process ID and user address.
 
Constructor Summary
UserSymbolRecord(int pid, java.lang.String lookupValue, long addressValue)
          Creates a UserSymbolRecord with the given process ID, symbol lookup, and user address converted in probe context as a result of the DTrace umod(), ufunc(), or usym() action.
 
Method Summary
 int compareTo(UserSymbolRecord r)
          Compares this record with the given user symbol lookup and orders by the combined value of process ID first and address second.
 boolean equals(java.lang.Object o)
          Compares the specified object with this UserSymbolRecord for equality.
 long getAddress()
          Gets the symbol's user address.
 int getProcessID()
          Gets the process ID associated with this record's symbol.
 java.lang.String getSymbol()
          Gets the result of the address lookup in the same form returned by Consumer.lookupUserFunction(int pid, long address).
 UserSymbolRecord.Value getValue()
          Gets the composite value of the symbol's process ID and address.
 int hashCode()
          Overridden to ensure that equal instances have equal hash codes.
 java.lang.String toString()
          Gets the result of this symbol lookup.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserSymbolRecord

public UserSymbolRecord(int pid,
                        java.lang.String lookupValue,
                        long addressValue)
Creates a UserSymbolRecord with the given process ID, symbol lookup, and user address converted in probe context as a result of the DTrace umod(), ufunc(), or usym() action.

Supports XML persistence.

Parameters:
pid - non-negative user process ID
lookupValue - the result in the native DTrace library of looking up the symbol associated with the given user address
addressValue - symbol address
Throws:
java.lang.NullPointerException - if the given lookup value is null
java.lang.IllegalArgumentException - if the given process ID is negative
Method Detail

getProcessID

public int getProcessID()
Gets the process ID associated with this record's symbol.

Returns:
non-negative pid

getSymbol

public java.lang.String getSymbol()
Gets the result of the address lookup in the same form returned by Consumer.lookupUserFunction(int pid, long address).

Specified by:
getSymbol in interface SymbolValueRecord
Returns:
non-null address lookup in the format defined by the native DTrace library

getAddress

public long getAddress()
Gets the symbol's user address.

Specified by:
getAddress in interface SymbolValueRecord
Returns:
the symbol's user address

getValue

public UserSymbolRecord.Value getValue()
Gets the composite value of the symbol's process ID and address. The value is used in equals() and compareTo() to test equality and to determine the natural ordering of UserSymbolRecord instances.

Specified by:
getValue in interface ValueRecord
Returns:
non-null composite value of the symbols's process ID and address

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this UserSymbolRecord for equality. Returns true if and only if the specified object is also a UserSymbolRecord and both records have the same process ID and the same address.

Overrides:
equals in class java.lang.Object
Returns:
true if and only if the specified object is also a UserSymbolRecord and both records have the same process ID and the same address

hashCode

public int hashCode()
Overridden to ensure that equal instances have equal hash codes.

Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(UserSymbolRecord r)
Compares this record with the given user symbol lookup and orders by the combined value of process ID first and address second. The comparison treats addresses as unsigned values so the ordering is consistent with that defined in the native DTrace library. The compareTo() method is compatible with equals().

Specified by:
compareTo in interface java.lang.Comparable<UserSymbolRecord>
Returns:
-1, 0, or 1 as this record's combined process ID and address is less than, equal to, or greater than the given record's combined process ID and address

toString

public java.lang.String toString()
Gets the result of this symbol lookup. The format is defined in the native DTrace library and is as stable as that library definition.

Overrides:
toString in class java.lang.Object
Returns:
getSymbol()