Trace Files
When the infrastructure is enabled, it generates a trace file
for each Jikes RVM virtual processor, and one meta file.
This section describes the
structure of the trace and meta files, and discusses how the data gathered
enables the system to meet the design goals enumerated in
Section *.
The core of the trace file is a series of trace records. Each trace
record represents a measurement period in which exactly one Java thread
was executing on the given virtual processor. The HPM counters are
read at the beginning and end of the measurement period and the change
in the counter values is reported in the trace record. A trace record
contains the following data:
- Virtual Processor ID
-
This field contains the unique ID of the virtual processor that was executing
during the measurement period.
Although this information can be inferred (each trace file
contains trace records from exactly one virtual processor), we chose
to encode this in the trace record to simplify merging multiple trace
files into a single file that represents an SMP execution trace.
- Thread ID
- This field
contains the unique ID of the thread that was executing
during the measurement period.
- Thread Yield Status
- This boolean field captures
if the thread yielded before its scheduling quantum
expired. It is implemented by negating
the thread ID.
- Top Method ID
-
This field contains the unique ID of the
top method on the runtime stack at the end of the
measurement period,
excluding the scheduler method taking the sample. Because
the complete stack is available, this field could be extended to capture
more methods as was done to guide profile-directed
inlining [18].
- Real Time
- This field contains the value of the PowerPC time base register
at the beginning of the measurement period represented by this trace
record. The time base register contains a 64-bit unsigned quantity
that is incremented periodically (at an implementation-defined
interval) [22].
- Real Time Duration
- This field contains the
duration of the measurement period as
measured by the difference in the time base register between the start and
end of the measurement period.
- Hardware Counter Values
- These fields contain
the change in each hardware counter value during
the measurement period. The number of hardware counters varies among
different implementations of the PowerPC architecture.
In most anticipated uses, one of the counters will be
counting cycles executed, but this is not required by the
infrastructure.
As each trace record contains hardware counter values for a single
Java thread on a single virtual processor, we are able to gather
thread-specific HPM data. The key element for SMP support is the
inclusion in the trace record of the real time values read from the
PowerPC time base register. The primary use of the real time value is
to merge together multiple trace files by sorting the trace records in
the combined trace by the real time values to create a single trace that
accurately models concurrent events on multiple processors. A secondary use
of this data is to detect that the OS has scheduled other Pthreads on
the processor during the measurement interval. Large discrepancies between
the real time delta and the executed cycles as reported by the hardware
counter indicate that some OS scheduling activity has occurred and
that the Pthread shared the processor during the measurement period.
Recall that the OS extension already distinguishes counters for each
OS kernel thread.
In addition to trace records containing hardware counter values,
a trace file may also contain marker records.
We provide a mechanism, via calls to the VM, for a Java
thread to specify program points that
when executed will place a marker record in the trace file.
These marker trace records, which
can contain an arbitrary string, allow the programmer to
focus on particular portions of an execution's trace.
Because this mechanism is available at the Java level, it can be used to
filter both application and VM activities, such as the various stages
of garbage collection.
A meta file is generated in conjunction with a benchmark's trace files.
The meta file specifies the number of HPM counter values in each
trace record and provides the following mappings:
from counter to event name,
from thread ID to thread name, and
from method ID to method signature.
The number of counters and the mappings provide a mechanism to interpret
a trace record, reducing a trace record's size by eliminating the need to
name trace record items in each individual trace record.