8 #ifndef LIBNEXUS_RV_TRACE_DECODER_H
9 #define LIBNEXUS_RV_TRACE_DECODER_H
13 #include "return-stack.h"
100 uint8_t exception : 1;
135 NEXUSRV_Trace_Event_None,
136 NEXUSRV_Trace_Event_Direct,
137 NEXUSRV_Trace_Event_DirectSync,
138 NEXUSRV_Trace_Event_Trap,
139 NEXUSRV_Trace_Event_Indirect,
140 NEXUSRV_Trace_Event_IndirectSync,
141 NEXUSRV_Trace_Event_Sync,
142 NEXUSRV_Trace_Event_Stop,
143 NEXUSRV_Trace_Event_Error,
146 static inline const char
147 *str_nexusrv_trace_event(
unsigned event) {
149 case NEXUSRV_Trace_Event_None:
151 case NEXUSRV_Trace_Event_Direct:
153 case NEXUSRV_Trace_Event_DirectSync:
154 return "direct-sync";
155 case NEXUSRV_Trace_Event_Trap:
157 case NEXUSRV_Trace_Event_Indirect:
159 case NEXUSRV_Trace_Event_IndirectSync:
160 return "indirect-sync";
161 case NEXUSRV_Trace_Event_Sync:
163 case NEXUSRV_Trace_Event_Stop:
165 case NEXUSRV_Trace_Event_Error:
233 time &= (((uint64_t)1 << hwcfg->
ts_bits) - 1);
235 unsigned __int128 normalized = time;
236 normalized *= 1000UL * 1000 * 1000;
NexusRV Message decoder configuration.
Definition: msg-decoder.h:23
unsigned ts_bits
Definition: msg-decoder.h:25
uint64_t timer_freq
Definition: msg-decoder.h:28
NexusRV Message decoder context.
Definition: msg-decoder.h:39
const nexusrv_hw_cfg * hw_cfg
Definition: msg-decoder.h:40
Decoded NexusRV Message.
Definition: msg-types.h:102
Definition: return-stack.h:17
NexusRV Trace decoder context.
Definition: trace-decoder.h:179
uint64_t full_addr
Definition: trace-decoder.h:191
struct nexusrv_hist_array * res_hists
Definition: trace-decoder.h:182
nexusrv_msg msg
Definition: trace-decoder.h:190
uint32_t res_icnt
Definition: trace-decoder.h:184
uint8_t consumed_tnts
Definition: trace-decoder.h:187
nexusrv_return_stack return_stack
Definition: trace-decoder.h:193
uint32_t consumed_icnt
Definition: trace-decoder.h:186
bool msg_present
Definition: trace-decoder.h:189
uint64_t timestamp
Definition: trace-decoder.h:192
uint32_t res_tnts
Definition: trace-decoder.h:185
nexusrv_msg_decoder * msg_decoder
Definition: trace-decoder.h:180
bool synced
Definition: trace-decoder.h:188
NexusRV Trace Error Event.
Definition: trace-decoder.h:119
uint32_t ecode
Definition: trace-decoder.h:120
uint8_t etype
Definition: trace-decoder.h:122
NexusRV Trace Indirect Branch Event.
Definition: trace-decoder.h:94
uint8_t interrupt
Definition: trace-decoder.h:99
uint8_t ownership_priv
Definition: trace-decoder.h:103
uint8_t ownership_v
Definition: trace-decoder.h:104
uint8_t ownership
Definition: trace-decoder.h:100
uint64_t context
Definition: trace-decoder.h:96
uint8_t ownership_fmt
Definition: trace-decoder.h:102
uint64_t target
Definition: trace-decoder.h:95
NexusRV Stop Event.
Definition: trace-decoder.h:128
uint8_t evcode
Definition: trace-decoder.h:129
NexusRV Trace Sync Event.
Definition: trace-decoder.h:110
uint64_t addr
Definition: trace-decoder.h:111
uint8_t sync
Definition: trace-decoder.h:113
int nexusrv_trace_decoder_init(nexusrv_trace_decoder *decoder, nexusrv_msg_decoder *msg_decoder)
Initialize the trace decoder.
int32_t nexusrv_trace_try_retire(nexusrv_trace_decoder *decoder, uint32_t icnt, unsigned *event)
Try to retire icnt from trace.
int nexusrv_trace_next_tnt(nexusrv_trace_decoder *decoder)
Get the next taken-not-taken.
uint32_t nexusrv_trace_available_icnt(nexusrv_trace_decoder *decoder)
Get the available I-CNT before needing to fetch new messages.
int nexusrv_trace_sync_reset(nexusrv_trace_decoder *decoder, nexusrv_trace_sync *sync)
Synchronize the trace decoder.
struct nexusrv_trace_sync nexusrv_trace_sync
NexusRV Trace Sync Event.
nexusrv_trace_events
NexusRV trace events.
Definition: trace-decoder.h:134
void nexusrv_trace_add_timestamp(nexusrv_trace_decoder *decoder, uint64_t timestamp)
Add(retire) the timestamp to decoder.
void nexusrv_trace_decoder_fini(nexusrv_trace_decoder *decoder)
Finialize the trace decoder.
struct nexusrv_trace_error nexusrv_trace_error
NexusRV Trace Error Event.
int nexusrv_trace_next_stop(nexusrv_trace_decoder *decoder, nexusrv_trace_stop *stop)
Get the next Stop event.
struct nexusrv_trace_decoder nexusrv_trace_decoder
NexusRV Trace decoder context.
int nexusrv_trace_next_error(nexusrv_trace_decoder *decoder, nexusrv_trace_error *error)
Get the next Error event.
struct nexusrv_trace_stop nexusrv_trace_stop
NexusRV Stop Event.
struct nexusrv_trace_indirect nexusrv_trace_indirect
NexusRV Trace Indirect Branch Event.
int nexusrv_trace_next_indirect(nexusrv_trace_decoder *decoder, nexusrv_trace_indirect *indirect)
Get the next indirect branch.
int nexusrv_trace_next_sync(nexusrv_trace_decoder *decoder, nexusrv_trace_sync *sync)
Get the next Sync event.