Revision 014d0d6ca05a357cac87ca00effe8ed152303376 authored by mergify[bot] on 06 September 2022, 15:07:59 UTC, committed by GitHub on 06 September 2022, 15:07:59 UTC
* add separated runs by UUID (#9367) This _should_ be the last piece needed for this tool. This allows the tool to generate reports on multiple experimental runs that may have been performed against the same chain. The `load` tool has been updated to generate a `UUID` on startup to uniquely identify each experimental run. The `report` tool separates all of the results it reads by `UUID` and performs separate calculations for each discovered experiment. Sample output is as follows ``` Experiment ID: 6bd7d1e8-d82c-4dbe-a1b3-40ab99e4fa30 Connections: 1 Rate: 1000 Size: 1024 Total Valid Tx: 9000 Total Negative Latencies: 0 Minimum Latency: 86.632837ms Maximum Latency: 1.151089602s Average Latency: 813.759361ms Standard Deviation: 225.189977ms Experiment ID: 453960af-6295-4282-aed6-367fc17c0de0 Connections: 1 Rate: 1000 Size: 1024 Total Valid Tx: 9000 Total Negative Latencies: 0 Minimum Latency: 79.312992ms Maximum Latency: 1.162446243s Average Latency: 422.755139ms Standard Deviation: 241.832475ms Total Invalid Tx: 0 ``` closes: #9352 #### PR checklist - [ ] Tests written/updated, or no tests needed - [ ] `CHANGELOG_PENDING.md` updated, or no changelog entry needed - [ ] Updated relevant documentation (`docs/`) and code comments, or no documentation updates needed (cherry picked from commit 1067ba15719b89a74c89bcbec065062d2d0159d8) # Conflicts: # go.mod * fix merge conflict * fix lint Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com> Co-authored-by: William Banfield <wbanfield@gmail.com>
1 parent 441405e
base_reactor.go
package p2p
import (
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/p2p/conn"
)
// Reactor is responsible for handling incoming messages on one or more
// Channel. Switch calls GetChannels when reactor is added to it. When a new
// peer joins our node, InitPeer and AddPeer are called. RemovePeer is called
// when the peer is stopped. Receive is called when a message is received on a
// channel associated with this reactor.
//
// Peer#Send or Peer#TrySend should be used to send the message to a peer.
type Reactor interface {
service.Service // Start, Stop
// SetSwitch allows setting a switch.
SetSwitch(*Switch)
// GetChannels returns the list of MConnection.ChannelDescriptor. Make sure
// that each ID is unique across all the reactors added to the switch.
GetChannels() []*conn.ChannelDescriptor
// InitPeer is called by the switch before the peer is started. Use it to
// initialize data for the peer (e.g. peer state).
//
// NOTE: The switch won't call AddPeer nor RemovePeer if it fails to start
// the peer. Do not store any data associated with the peer in the reactor
// itself unless you don't want to have a state, which is never cleaned up.
InitPeer(peer Peer) Peer
// AddPeer is called by the switch after the peer is added and successfully
// started. Use it to start goroutines communicating with the peer.
AddPeer(peer Peer)
// RemovePeer is called by the switch when the peer is stopped (due to error
// or other reason).
RemovePeer(peer Peer, reason interface{})
// Receive is called by the switch when msgBytes is received from the peer.
//
// NOTE reactor can not keep msgBytes around after Receive completes without
// copying.
//
// CONTRACT: msgBytes are not nil.
Receive(chID byte, peer Peer, msgBytes []byte)
}
//--------------------------------------
type BaseReactor struct {
service.BaseService // Provides Start, Stop, .Quit
Switch *Switch
}
func NewBaseReactor(name string, impl Reactor) *BaseReactor {
return &BaseReactor{
BaseService: *service.NewBaseService(nil, name, impl),
Switch: nil,
}
}
func (br *BaseReactor) SetSwitch(sw *Switch) {
br.Switch = sw
}
func (*BaseReactor) GetChannels() []*conn.ChannelDescriptor { return nil }
func (*BaseReactor) AddPeer(peer Peer) {}
func (*BaseReactor) RemovePeer(peer Peer, reason interface{}) {}
func (*BaseReactor) Receive(chID byte, peer Peer, msgBytes []byte) {}
func (*BaseReactor) InitPeer(peer Peer) Peer { return peer }
Computing file changes ...