Documentation ¶
Index ¶
- func Init()
- type BufferedTrace
- type DirectTrace
- func (t *DirectTrace) Ethereum(e EventType, configNr int64, gasCost int64)
- func (t *DirectTrace) Event(e EventType, sampledVal int64, val0 int64)
- func (t *DirectTrace) Protocol(e EventType, seqNr int32)
- func (t *DirectTrace) Request(e EventType, clID int32, clSN int32)
- func (t *DirectTrace) Start(outFileName string, nodeID int32)
- func (t *DirectTrace) Stop()
- func (t *DirectTrace) StopOnSignal(sig os.Signal, exit bool)
- type EventType
- type GenericEvent
- type Trace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BufferedTrace ¶
type BufferedTrace struct { // Only trace events whose SampledVal is is a multiple of Sampling. // (E.g., client sequence number for request events, sequence number for protocol events is meant to be stored there) Sampling int BufferCapacity int ProtocolEventCapacity int RequestEventCapacity int EthereumEventCapacity int // contains filtered or unexported fields }
func (*BufferedTrace) Event ¶
func (bt *BufferedTrace) Event(e EventType, sampledVal int64, val0 int64)
Create a new protocol trace event.
func (*BufferedTrace) Start ¶
func (bt *BufferedTrace) Start(outFileName string, nodeID int32)
func (*BufferedTrace) Stop ¶
func (bt *BufferedTrace) Stop()
Writes the in-memory traces to a file specified at the call to Start(). Stop() must be called in order to obtain meaningful output.
func (*BufferedTrace) StopOnSignal ¶
func (bt *BufferedTrace) StopOnSignal(sig os.Signal, exit bool)
type DirectTrace ¶
type DirectTrace struct { // Only trace events whose sequence number (clSn for request events, seqNr for protocol events) // is is a multiple of Sampling. Sampling int // contains filtered or unexported fields }
func (*DirectTrace) Ethereum ¶
func (t *DirectTrace) Ethereum(e EventType, configNr int64, gasCost int64)
Create a new request trace event.
func (*DirectTrace) Event ¶
func (t *DirectTrace) Event(e EventType, sampledVal int64, val0 int64)
Create a new trace event.
func (*DirectTrace) Protocol ¶
func (t *DirectTrace) Protocol(e EventType, seqNr int32)
Create a new protocol trace event.
func (*DirectTrace) Request ¶
func (t *DirectTrace) Request(e EventType, clID int32, clSN int32)
Create a new request trace event.
func (*DirectTrace) Start ¶
func (t *DirectTrace) Start(outFileName string, nodeID int32)
Starts the tracing of this DirectTrace. No call to Event(), Protocol(), Request() or Ethereum() must be made before Start() returned. If Start() has been called, then Stop() must be called as well to perform the necessary cleanup before the process finishes.
func (*DirectTrace) Stop ¶
func (t *DirectTrace) Stop()
Stops the tracing and performs the necessary cleanup (closes the output file). Stop() must be called in order to obtain meaningful output.
func (*DirectTrace) StopOnSignal ¶
func (t *DirectTrace) StopOnSignal(sig os.Signal, exit bool)
Sets up a signal handler that calls Stop() when the specified OS signal occurs. This is useful for tracing if the program does not terminate gracefully, but is stopped using an OS signal. StopOnSignal() can be used in this case to still stop the tracer (flushing buffer contents). If the exit flag is set to true, the signal handler will exit the process after stopping the tracer.
type GenericEvent ¶
type GenericEvent struct { EventType EventType Timestamp int64 NodeId int32 SampledVal int64 Val0 int64 }
type ProtocolEvent struct { EventType EventType Timestamp int64 PeerId int32 SeqNr int32 }
type RequestEvent struct { EventType EventType Timestamp int64 ClId int32 ClSn int32 PeerId int32 }
type EthereumEvent struct { EventType EventType Timestamp int64 PeerId int32 ConfigNr int64 GasCost int64 }
type Trace ¶
type Trace interface { // Starts the tracing of this Trace. // No call to Event(), Protocol() or Request() must be made before Start() returned. // If Start() has been called, then Stop() must be called as well // to perform the necessary cleanup before the process finishes. Start(outFileName string, nodeID int32) // Create a new trace event // sampledVal and val0 are integers whose interpretation depends on the event type. // However, sampledVal is also used for sampling Event(e EventType, sampledVal int64, val0 int64) // Stops the tracing and performs the necessary cleanup (e.g. closes the output file). // Stop() must be called in order to obtain meaningful output. Stop() // Sets up a signal handler that calls Stop() when the specified OS signal occurs. // This is useful for tracing if the program does not terminate gracefully, but is stopped using an OS signal. // StopOnSignal() can be used in this case to still stop the tracer (flushing buffer contents). // If the exit flag is set to true, the signal handler will exit the process after stopping the tracer. StopOnSignal(sig os.Signal, exit bool) }
var (
MainTrace Trace
)
A global instance of a trace object to be used from anywhere in the code, without having to keep around a reference and dereference it.