mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 20:21:06 +00:00
Per subsystem CPU usage tracking (#4239)
* SubsystemContext: add subsystem name str Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Overseer builder proc macro changes * initilize SubsystemContext name field. * Add subsystem name in TaskKind::launch_task() Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Update ToOverseer enum Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Assign subsystem names to orphan tasks Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * SubsystemContext: add subsystem name str Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Overseer builder proc macro changes * initilize SubsystemContext name field. * Add subsystem name in TaskKind::launch_task() Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Update ToOverseer enum Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Assign subsystem names to orphan tasks Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Rebase changes for new spawn() group param Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Add subsystem constat in JobTrait Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Add subsystem string Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix spawn() calls Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix more tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Address PR review feedback #1 Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Address PR review round 2 Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fixes - remove JobTrait::Subsystem - fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * update Cargo.lock Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -562,7 +562,10 @@ where
|
||||
|
||||
futures::future::ready(())
|
||||
});
|
||||
overseer.spawner().spawn("metrics_metronome", Box::pin(metronome));
|
||||
overseer
|
||||
.spawner()
|
||||
.spawn("metrics-metronome", Some("overseer"), Box::pin(metronome));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -616,11 +619,11 @@ where
|
||||
},
|
||||
msg = self.to_overseer_rx.select_next_some() => {
|
||||
match msg {
|
||||
ToOverseer::SpawnJob { name, s } => {
|
||||
self.spawn_job(name, s);
|
||||
ToOverseer::SpawnJob { name, subsystem, s } => {
|
||||
self.spawn_job(name, subsystem, s);
|
||||
}
|
||||
ToOverseer::SpawnBlockingJob { name, s } => {
|
||||
self.spawn_blocking_job(name, s);
|
||||
ToOverseer::SpawnBlockingJob { name, subsystem, s } => {
|
||||
self.spawn_blocking_job(name, subsystem, s);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -772,11 +775,21 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn spawn_job(&mut self, name: &'static str, j: BoxFuture<'static, ()>) {
|
||||
self.spawner.spawn(name, j);
|
||||
fn spawn_job(
|
||||
&mut self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
j: BoxFuture<'static, ()>,
|
||||
) {
|
||||
self.spawner.spawn(task_name, subsystem_name, j);
|
||||
}
|
||||
|
||||
fn spawn_blocking_job(&mut self, name: &'static str, j: BoxFuture<'static, ()>) {
|
||||
self.spawner.spawn_blocking(name, j);
|
||||
fn spawn_blocking_job(
|
||||
&mut self,
|
||||
task_name: &'static str,
|
||||
subsystem_name: Option<&'static str>,
|
||||
j: BoxFuture<'static, ()>,
|
||||
) {
|
||||
self.spawner.spawn_blocking(task_name, subsystem_name, j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1151,6 +1151,7 @@ fn context_holds_onto_message_until_enough_signals_received() {
|
||||
stream::select(bounded_rx, unbounded_rx),
|
||||
channels_out,
|
||||
to_overseer_tx,
|
||||
"test",
|
||||
);
|
||||
|
||||
assert_eq!(ctx.signals_received.load(), 0);
|
||||
|
||||
Reference in New Issue
Block a user