dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t Class Reference

#include <scheduler.h>

Inheritance diagram for dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t:
dynamorio::drmemtrace::memtrace_stream_t

Public Member Functions

virtual stream_status_t next_record (RecordType &record)
 
virtual stream_status_t next_record (RecordType &record, uint64_t cur_time)
 
virtual stream_status_t unread_last_record ()
 
virtual stream_status_t start_speculation (addr_t start_address, bool queue_current_record)
 
virtual stream_status_t stop_speculation ()
 
virtual stream_status_t set_active (bool active)
 
uint64_t get_record_ordinal () const override
 
uint64_t get_instruction_ordinal () const override
 
std::string get_stream_name () const override
 
virtual input_ordinal_t get_input_stream_ordinal () const
 
virtual int get_input_workload_ordinal () const
 
uint64_t get_last_timestamp () const override
 
uint64_t get_first_timestamp () const override
 
uint64_t get_version () const override
 
uint64_t get_filetype () const override
 
uint64_t get_cache_line_size () const override
 
uint64_t get_chunk_instr_count () const override
 
uint64_t get_page_size () const override
 
bool is_record_synthetic () const override
 
int64_t get_output_cpuid () const override
 
int64_t get_workload_id () const override
 
int64_t get_input_id () const override
 
int64_t get_tid () const override
 
memtrace_stream_tget_input_interface () const override
 
output_ordinal_t get_output_stream_ordinal () const
 
int get_shard_index () const override
 
bool is_record_kernel () const override
 
- Public Member Functions inherited from dynamorio::drmemtrace::memtrace_stream_t
virtual ~memtrace_stream_t ()
 

Detailed Description

template<typename RecordType, typename ReaderType>
class dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t

Represents a stream of RecordType trace records derived from a subset of a set of input recorded traces. Provides more information about the record stream using the dynamorio::drmemtrace::memtrace_stream_t API.

Member Function Documentation

◆ get_cache_line_size()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_cache_line_size ( ) const
inlineoverridevirtual

Returns the cache line size from the TRACE_MARKER_TYPE_CACHE_LINE_SIZE record in the trace header.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_chunk_instr_count()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_chunk_instr_count ( ) const
inlineoverridevirtual

Returns the chunk instruction count from the TRACE_MARKER_TYPE_CHUNK_INSTR_COUNT record in the trace header.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_filetype()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_filetype ( ) const
inlineoverridevirtual

Returns the OFFLINE_FILE_TYPE_* bitfields of type offline_file_type_t identifying the architecture and other key high-level attributes of the trace from the TRACE_MARKER_TYPE_FILETYPE record in the trace header. This can be queried prior to explicitly retrieving any records from output streams, unless dynamorio::drmemtrace::scheduler_tmpl_t:: scheduler_options_t.read_inputs_in_init is false.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_first_timestamp()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_first_timestamp ( ) const
inlineoverridevirtual

Returns the value of the first seen TRACE_MARKER_TYPE_TIMESTAMP marker.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_input_id()

template<typename RecordType , typename ReaderType >
int64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_input_id ( ) const
inlineoverridevirtual

Returns the ordinal for the current input stream feeding this output stream.

Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.

◆ get_input_interface()

template<typename RecordType , typename ReaderType >
memtrace_stream_t* dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_input_interface ( ) const
inlineoverridevirtual

Returns the dynamorio::drmemtrace::memtrace_stream_t interface for the current input stream feeding this output stream.

Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.

◆ get_input_stream_ordinal()

template<typename RecordType , typename ReaderType >
virtual input_ordinal_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_input_stream_ordinal ( ) const
inlinevirtual

Returns the ordinal for the current input stream feeding this output stream.

◆ get_input_workload_ordinal()

template<typename RecordType , typename ReaderType >
virtual int dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_input_workload_ordinal ( ) const
inlinevirtual

Returns the ordinal for the workload which is the source of the current input stream feeding this output stream. This workload ordinal is the index into the vector of type dynamorio::drmemtrace::scheduler_tmpl_t::input_workload_t passed to init(). Returns -1 if there is no current input for this output stream.

◆ get_instruction_ordinal()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_instruction_ordinal ( ) const
inlineoverridevirtual

Returns the count of instructions from the start of the trace to this point. For record_scheduler_t, if any encoding records or the internal record TRACE_MARKER_TYPE_BRANCH_TARGET records are present prior to an instruction marker, the count will increase at the first of those records as they are considered part of the instruction. If SCHEDULER_USE_INPUT_ORDINALS is set, then this value matches the instruction ordinal for the current input stream (and thus might decrease or not change across records if the input changed). Otherwise, if multiple input streams fed into this output stream, this includes the records from all those streams that were presented here: thus, this may be larger than what the current input stream reports (see get_input_stream_interface() and get_input_stream_ordinal()). This does not advance across skipped records in an input stream from a region of interest (see dynamorio::drmemtrace::scheduler_tmpl_t::range_t), but it does advance if the output stream skipped ahead.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_last_timestamp()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_last_timestamp ( ) const
inlineoverridevirtual

Returns the value of the most recently seen TRACE_MARKER_TYPE_TIMESTAMP marker.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_output_cpuid()

template<typename RecordType , typename ReaderType >
int64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_output_cpuid ( ) const
inlineoverridevirtual

Returns a unique identifier for the current output stream. For MAP_TO_RECORDED_OUTPUT, the identifier is the as-traced cpuid mapped to this output. For dynamic schedules, the identifier is the output stream ordinal, except for OFFLINE_FILE_TYPE_CORE_SHARDED inputs where the identifier is the input stream ordinal.

Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.

◆ get_output_stream_ordinal()

template<typename RecordType , typename ReaderType >
output_ordinal_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_output_stream_ordinal ( ) const
inline

Returns the ordinal for the current output stream. If dynamorio::drmemtrace::scheduler_tmpl_t::scheduler_options_t:: single_lockstep_output is set to true, this returns the ordinal of the currently active "inner" output stream. Otherwise, this returns the constant ordinal for this output stream as there is no concept of inner or outer streams.

◆ get_page_size()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_page_size ( ) const
inlineoverridevirtual

Returns the page size from the TRACE_MARKER_TYPE_PAGE_SIZE record in the trace header.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_record_ordinal()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_record_ordinal ( ) const
inlineoverridevirtual

Returns the count of memref_t records from the start of the trace to this point. It does not include synthetic records (see is_record_synthetic()).

If SCHEDULER_USE_INPUT_ORDINALS is set, then this value matches the record ordinal for the current input stream (and thus might decrease or not change across records if the input changed). Otherwise, if multiple input streams fed into this output stream, this includes the records from all those streams that were presented here: thus, this may be larger than what the current input stream reports (see get_input_stream_interface() and get_input_stream_ordinal()). This does not advance across skipped records in an input stream from a region of interest (see dynamorio::drmemtrace::scheduler_tmpl_t::range_t), but it does advance if the output stream skipped ahead.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_shard_index()

template<typename RecordType , typename ReaderType >
int dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_shard_index ( ) const
inlineoverridevirtual

For SCHEDULER_USE_INPUT_ORDINALS or SCHEDULER_USE_SINGLE_INPUT_ORDINALS, returns the input stream ordinal, except for the case of a single combined-stream input with the passed-in thread id set to INVALID_THREAD_ID (the serial analysis mode for analyzer tools) in which case the last trace record's tid is returned; otherwise returns the output stream ordinal.

Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.

◆ get_stream_name()

template<typename RecordType , typename ReaderType >
std::string dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_stream_name ( ) const
inlineoverridevirtual

Returns a name for the current input stream feeding this output stream. For stored offline traces, this is the base name of the trace on disk. For online traces, this is the name of the pipe.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_tid()

template<typename RecordType , typename ReaderType >
int64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_tid ( ) const
inlineoverridevirtual

Returns the thread identifier for the current input stream feeding this output stream.

Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.

◆ get_version()

template<typename RecordType , typename ReaderType >
uint64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_version ( ) const
inlineoverridevirtual

Returns the trace_version_t value from the TRACE_MARKER_TYPE_VERSION record in the trace header. This can be queried prior to explicitly retrieving any records from output streams, unless dynamorio::drmemtrace::scheduler_tmpl_t:: scheduler_options_t.read_inputs_in_init is false.

Implements dynamorio::drmemtrace::memtrace_stream_t.

◆ get_workload_id()

template<typename RecordType , typename ReaderType >
int64_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::get_workload_id ( ) const
inlineoverridevirtual

◆ is_record_kernel()

template<typename RecordType , typename ReaderType >
bool dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::is_record_kernel ( ) const
inlineoverridevirtual

Returns whether the current record is from a part of the trace corresponding to kernel execution.

Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.

◆ is_record_synthetic()

template<typename RecordType , typename ReaderType >
bool dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::is_record_synthetic ( ) const
inlineoverridevirtual

Returns whether the current record was synthesized and inserted into the record stream and was not present in the original stream. This is true for timestamp and cpuid headers duplicated after skipping ahead, as well as cpuid markers inserted for synthetic schedules. Such records do not cound toward the record count and get_record_ordinal() will return the value of the prior record.

Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.

◆ next_record() [1/2]

template<typename RecordType , typename ReaderType >
virtual stream_status_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::next_record ( RecordType &  record)
virtual

Advances to the next record in the stream. Returns a status code on whether and how to continue.

◆ next_record() [2/2]

template<typename RecordType , typename ReaderType >
virtual stream_status_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::next_record ( RecordType &  record,
uint64_t  cur_time 
)
virtual

Advances to the next record in the stream. Returns a status code on whether and how to continue. Supplies the current time for QUANTUM_TIME. The time should be considered to be the time prior to processing the returned record. The time is unitless but needs to be a globally consistent increasing value across all output streams. STATUS_INVALID is returned if 0 or a value smaller than the start time of the current input's quantum is passed in when QUANTUM_TIME and MAP_TO_ANY_OUTPUT are specified.

◆ set_active()

template<typename RecordType , typename ReaderType >
virtual stream_status_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::set_active ( bool  active)
virtual

Disables or re-enables this output stream. If "active" is false, this stream becomes inactive and its currently assigned input is moved to the ready queue to be scheduled on other outputs. The STATUS_IDLE code is returned to next_record() for inactive streams. If "active" is true, this stream becomes active again. This is only supported for MAP_TO_ANY_OUTPUT.

◆ start_speculation()

template<typename RecordType , typename ReaderType >
virtual stream_status_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::start_speculation ( addr_t  start_address,
bool  queue_current_record 
)
virtual

Begins a diversion from the regular inputs to a side stream of records representing speculative execution starting at 'start_address'.

Because the instruction record after a branch typically needs to be read before knowing whether a simulator is on the wrong path or not, this routine supports putting back the current record so that it will be re-provided as the first record after stop_speculation(), if "queue_current_record" is true. The same caveats on the input stream ordinals and last timestamp described under unread_last_record() apply to this record queueing. Calling start_speculation() immediately after unread_last_record() and requesting queueing will return a failure code.

This call can be nested; each call needs to be paired with a corresponding stop_speculation() call.

◆ stop_speculation()

template<typename RecordType , typename ReaderType >
virtual stream_status_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::stop_speculation ( )
virtual

Stops speculative execution, resuming execution at the stream of records from the point at which the prior matching start_speculation() call was made, either repeating the current record at that time (if "true" was passed for "queue_current_record" to start_speculation()) or continuing on the subsequent record (if "false" was passed). Returns STATUS_INVALID if there was no prior start_speculation() call.

◆ unread_last_record()

template<typename RecordType , typename ReaderType >
virtual stream_status_t dynamorio::drmemtrace::scheduler_tmpl_t< RecordType, ReaderType >::stream_t::unread_last_record ( )
virtual

Queues the last-read record returned by next_record() such that it will be returned on the subsequent call to next_record() when this same input is active. Causes ordinal queries on the current input to be off by one until the record is re-read. Furthermore, the get_last_timestamp() query may still include this record, whether called on the input or output stream, immediately after this call. Fails if called multiple times in a row without an intervening next_record() call. Fails if called during speculation (between start_speculation() and stop_speculation() calls).


The documentation for this class was generated from the following file:
  • /home/runner/work/dynamorio/dynamorio/build_release-64/clients/include/drmemtrace/scheduler.h