-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profile code #22
base: main
Are you sure you want to change the base?
Profile code #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated some of the tasks' names to better reflect the structure of the code.
@@ -36,12 +40,12 @@ impl Consensus { | |||
x | |||
})?; | |||
let network_receiver = NetReceiver::new(address, tx_core.clone()); | |||
tokio::spawn(async move { | |||
pspawn!("Net-Receiver", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Net-Receiver", { | |
pspawn!("Consensus-Receiver", { |
network_receiver.run().await; | ||
}); | ||
|
||
let mut network_sender = NetSender::new(rx_network); | ||
tokio::spawn(async move { | ||
pspawn!("Net-Sender", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Net-Sender", { | |
pspawn!("Consensus-Sender", { |
@@ -22,7 +25,7 @@ impl<Mempool: 'static + NodeMempool> MempoolDriver<Mempool> { | |||
pub fn new(mempool: Mempool, core_channel: Sender<CoreMessage>, store: Store) -> Self { | |||
let (tx_inner, mut rx_inner): (_, Receiver<DriverMessage>) = channel(1000); | |||
let mut waiting = FuturesUnordered::new(); | |||
tokio::spawn(async move { | |||
pspawn!("Mempool", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Mempool", { | |
pspawn!("Mempool-Driver", { |
@@ -45,7 +48,7 @@ impl SimpleMempool { | |||
})?; | |||
|
|||
let front = Front::new(address, tx_client); | |||
tokio::spawn(async move { | |||
pspawn!("Simple-Mempool-Front", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Simple-Mempool-Front", { | |
pspawn!("Mempool-Txs-Receiver", { |
@@ -38,7 +41,7 @@ impl Front { | |||
} | |||
|
|||
async fn spawn_worker(socket: TcpStream, peer: SocketAddr, deliver: Sender<Transaction>) { | |||
tokio::spawn(async move { | |||
pspawn!("Front-Worker", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Front-Worker", { | |
pspawn!("Txs-Receiver-Worker", { |
@@ -55,12 +58,12 @@ impl SimpleMempool { | |||
x | |||
})?; | |||
let network_receiver = NetReceiver::new(address, tx_core); | |||
tokio::spawn(async move { | |||
pspawn!("Simple-Mempool-Receiver", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Simple-Mempool-Receiver", { | |
pspawn!("Mempool-Receiver", { |
network_receiver.run().await; | ||
}); | ||
|
||
let mut network_sender = NetSender::new(rx_network); | ||
tokio::spawn(async move { | ||
pspawn!("Simple-Mempool-Sender", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Simple-Mempool-Sender", { | |
pspawn!("Mempool-Sender", { |
@@ -76,7 +79,7 @@ impl SimpleMempool { | |||
/* client_channel */ rx_client, | |||
/* network_channel */ tx_network, | |||
); | |||
tokio::spawn(async move { | |||
pspawn!("Core-Runner", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!("Core-Runner", { | |
pspawn!("Mempool-Core", { |
@@ -60,7 +63,7 @@ impl NetSender { | |||
async fn spawn_worker(address: SocketAddr) -> Sender<Bytes> { | |||
// Each worker handle a TCP connection with on address. | |||
let (tx, mut rx) = channel(1000); | |||
tokio::spawn(async move { | |||
pspawn!(format!("Net-Sender-{:?}", address), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!(format!("Net-Sender-{:?}", address), { | |
pspawn!(format!("Sender-Worker-{:?}", address), { |
@@ -118,7 +121,7 @@ impl<Message: 'static + Send + DeserializeOwned + Debug> NetReceiver<Message> { | |||
} | |||
|
|||
async fn spawn_worker(socket: TcpStream, peer: SocketAddr, deliver: Sender<Message>) { | |||
tokio::spawn(async move { | |||
pspawn!(format!("Net-Receiver-{:?}", peer), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pspawn!(format!("Net-Receiver-{:?}", peer), { | |
pspawn!(format!("Receiver-Worker-{:?}", peer), { |
The profiler requires the package
graphviz
and is used as follows: