|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opensolaris.os.dtrace.PrintaRecord
public final class PrintaRecord
A record generated by the DTrace printa()
action. Lists the
aggregations passed to printa()
and records the formatted
output associated with each Tuple
. If multiple aggregations
were passed to the printa()
action that generated this
record, then the DTrace library tabulates the output, using a default
format if no format string was specified. By default, the output
string associated with a given Tuple
includes a value from
each aggregation, or zero wherever an aggregation has no value
associated with that Tuple
. For example, the D statements
@a[123] = sum(1);
@b[456] = sum(2);
printa(@a, @b, @c);
produce output for the tuples "123" and "456" similar to the
following:
123 1 0 0
456 0 2 0
The first column after the tuple contains values from @a
,
the next column contains values from @b
, and the last
column contains zeros because @c
has neither a value
associated with "123" nor a value associated with "456".
If a format string is passed to printa()
, it may limit the
aggregation data available in this record. For example, if the
format string specifies a value placeholder for only one of two
aggregations passed to printa()
, then the resulting PrintaRecord
will contain only one Aggregation
. If no value
placeholder is specified, or if the aggregation tuple is not
completely specified, the resulting PrintaRecord
will contain
no aggregation data. However, the formatted output generated by the
DTrace library is available in all cases. For details about
printa()
format strings, see the
printa()
section of the Output
Formatting chapter of the Solaris Dynamic Tracing Guide.
Immutable. Supports persistence using XMLEncoder
.
Constructor Summary | |
---|---|
PrintaRecord(long snaptimeNanos,
java.util.Collection<Aggregation> aggs,
java.util.Map<Tuple,java.lang.String> formattedOutput,
java.util.List<Tuple> orderedTuples,
java.lang.String formattedOutputString)
Creates a record with the given snaptime, aggregations, and formatted output. |
Method Summary | |
---|---|
int |
compareTo(PrintaRecord r)
Compares the formatted output of this record
with that of the given record. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this PrintaRecord for
equality. |
Aggregation |
getAggregation(java.lang.String name)
Gets the named aggregation. |
java.util.List<Aggregation> |
getAggregations()
Gets a list of the aggregations passed to the printa()
action that generated this record. |
java.lang.String |
getFormattedString(Tuple key)
Gets the formatted string, if any, associated with the given aggregation tuple. |
java.util.Map<Tuple,java.lang.String> |
getFormattedStrings()
Gets the formatted output, if any, associated with each Tuple occurring in the aggregations belonging to this record,
one formatted string per Tuple . |
java.lang.String |
getOutput()
Gets this record's formatted output. |
long |
getSnaptime()
Gets the nanosecond timestamp of the aggregate snapshot used to create this printa() record. |
java.util.List<Tuple> |
getTuples()
Gets an ordered list of this record's aggregation tuples. |
int |
hashCode()
Overridden to ensure that equal instances have equal hash codes. |
java.lang.String |
toString()
Gets a string representation of this instance useful for logging and not intended for display. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PrintaRecord(long snaptimeNanos, java.util.Collection<Aggregation> aggs, java.util.Map<Tuple,java.lang.String> formattedOutput, java.util.List<Tuple> orderedTuples, java.lang.String formattedOutputString)
snaptimeNanos
- nanosecond timestamp of the snapshot used
to create this printa()
recordaggs
- aggregations passed to the printa()
action
that generated this recordformattedOutput
- the formatted output, if any, associated
with each Tuple
occurring in the aggregations belonging
to this record, one formatted string per Tuple
, or an
empty or null
map if an incomplete printa()
format string caused aggregation tuples to be omitted from this
recordorderedTuples
- list of aggregation tuples in the same order
generated by the native DTrace library (determined by the various
"aggsort" options such as Option.aggsortkey
)formattedOutputString
- printa()
formatted string
output in the same order generated by the native DTrace library
(determined by the various "aggsort" options such as
Option.aggsortkey
)
java.lang.NullPointerException
- if the given collection of
aggregations is null
, or if the given ordered lists of
tuples or formatted strings are null
java.lang.IllegalArgumentException
- if the given snaptime is
negativeMethod Detail |
---|
public long getSnaptime()
printa()
record.
public Aggregation getAggregation(java.lang.String name)
printa()
, or
null
if the named aggregation is not passed to printa()
, or if it is omitted due to an incomplete printa()
format string, or if it is empty (a future release of
this API may represent an empty DTrace aggregation as a non-null
Aggregation
with no records; users of this API should not
rely on a non-null return value to indicate a non-zero record
count)public java.util.List<Aggregation> getAggregations()
printa()
action that generated this record. The returned list is a copy,
and modifying it has no effect on this record. Supports XML
persistence.
public java.lang.String getFormattedString(Tuple key)
key
- aggregation tuple
null
if the given tuple does not
exist in the aggregations belonging to this record or if it
is omitted from this record due to an incomplete printa()
format stringgetFormattedStrings()
,
getOutput()
public java.util.Map<Tuple,java.lang.String> getFormattedStrings()
Tuple
occurring in the aggregations belonging to this record,
one formatted string per Tuple
. Gets an empty map if
aggregation tuples are omitted from this record due to an
incomplete printa()
format string. The returned map is a
copy and modifying it has no effect on this record. Supports XML
persistence.
printa(
) format
stringgetFormattedString(Tuple key)
,
getOutput()
public java.util.List<Tuple> getTuples()
Option.aggsortkey
, Option.aggsortrev
, Option.aggsortpos
, and Option.aggsortkeypos
optionspublic java.lang.String getOutput()
Option.aggsortkey
, Option.aggsortrev
, Option.aggsortpos
, and Option.aggsortkeypos
optionspublic boolean equals(java.lang.Object o)
PrintaRecord
for
equality. Returns true
if and only if the specified
object is also a PrintaRecord
and both records have the
same aggregations and the same formatted strings in the same
order (by aggregation tuple).
equals
in class java.lang.Object
true
if and only if the specified object is also
a PrintaRecord
and both records have the same
aggregations and the same formatted strings in the same order (by
aggregation tuple)public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(PrintaRecord r)
output
of this record
with that of the given record. Note that ordering printa
records by their output string values is incompatible with equals()
, which also checks the underlying
aggregation data for equality.
compareTo
in interface java.lang.Comparable<PrintaRecord>
public java.lang.String toString()
class-name[property1 = value1, property2 = value2]
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |