This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Per subsystem CPU usage tracking #4239
Merged
paritytech-processbot
merged 28 commits into
master
from
sandreim/per_subsystem_task_metrics
Nov 11, 2021
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
4eafe81
SubsystemContext: add subsystem name str
sandreim 255c147
Overseer builder proc macro changes
sandreim 6dca05c
Update ToOverseer enum
sandreim c0a332c
Assign subsystem names to orphan tasks
sandreim 26a6aac
cargo fmt
sandreim 5afa046
SubsystemContext: add subsystem name str
sandreim c88911c
Overseer builder proc macro changes
sandreim ba6f57a
Update ToOverseer enum
sandreim 710941e
Assign subsystem names to orphan tasks
sandreim 4a3bbbd
cargo fmt
sandreim d7a4a5e
Rebase changes for new spawn() group param
sandreim 61f27e6
Add subsystem constat in JobTrait
sandreim 5494f18
Add subsystem string
sandreim 266645a
Fix tests
sandreim 38fe1e8
Fix spawn() calls
sandreim cdfe97a
cargo fmt
sandreim b9f986f
Merge branch 'master' of github.com:paritytech/polkadot into sandreim…
sandreim 610abf4
Merge branch 'sandreim/per_subsystem_task_metrics' of github.com:pari…
sandreim 81d8af5
Fix
sandreim 95c50eb
Fix tests
sandreim 8b8e5dc
fix
sandreim cf80a1f
Fix more tests
sandreim 393fb66
Address PR review feedback #1
sandreim 3b4d098
Merge branch 'master' of github.com:paritytech/polkadot into sandreim…
sandreim 5fd25dd
Address PR review round 2
sandreim dae09bc
Fixes
sandreim 57a2e32
Merge branch 'master' into sandreim/per_subsystem_task_metrics
ordian 9cc4620
update Cargo.lock
ordian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,7 +337,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { | |
| // TODO generate a builder pattern that ensures this | ||
| // TODO https://github.com/paritytech/polkadot/issues/3427 | ||
| let #subsystem_name = match self. #subsystem_name { | ||
| FieldInitMethod::Fn(func) => func(handle.clone())?, | ||
| FieldInitMethod::Fn(func) => func(handle.clone())?, | ||
| FieldInitMethod::Value(val) => val, | ||
| FieldInitMethod::Uninitialized => | ||
| panic!("All subsystems must exist with the builder pattern."), | ||
|
|
@@ -349,11 +349,18 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { | |
| #channel_name_rx, #channel_name_unbounded_rx | ||
| ); | ||
| let (signal_tx, signal_rx) = #support_crate ::metered::channel(SIGNAL_CHANNEL_CAPACITY); | ||
|
|
||
| // Generate subsystem name based on overseer field name. | ||
| let mut subsystem_string = String::from(stringify!(#subsystem_name)); | ||
| // Convert owned `snake case` string to a `kebab case` static str. | ||
| let subsystem_static_str = Box::leak(subsystem_string.replace("_", "-").into_boxed_str()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not a fan of this, but seems correct |
||
|
|
||
| let ctx = #subsyste_ctx_name::< #consumes >::new( | ||
| signal_rx, | ||
| message_rx, | ||
| channels_out.clone(), | ||
| to_overseer_tx.clone(), | ||
| subsystem_static_str | ||
| ); | ||
|
|
||
| let #subsystem_name: OverseenSubsystem< #consumes > = | ||
|
|
@@ -364,6 +371,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { | |
| unbounded_meter, | ||
| ctx, | ||
| #subsystem_name, | ||
| subsystem_static_str, | ||
| &mut running_subsystems, | ||
| )?; | ||
| )* | ||
|
|
@@ -489,22 +497,22 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream { | |
| /// Task kind to launch. | ||
| pub trait TaskKind { | ||
| /// Spawn a task, it depends on the implementer if this is blocking or not. | ||
| fn launch_task<S: SpawnNamed>(spawner: &mut S, name: &'static str, future: BoxFuture<'static, ()>); | ||
| fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>); | ||
| } | ||
|
|
||
| #[allow(missing_docs)] | ||
| struct Regular; | ||
| impl TaskKind for Regular { | ||
| fn launch_task<S: SpawnNamed>(spawner: &mut S, name: &'static str, future: BoxFuture<'static, ()>) { | ||
| spawner.spawn(name, future) | ||
| fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) { | ||
| spawner.spawn(task_name, Some(subsystem_name), future) | ||
| } | ||
| } | ||
|
|
||
| #[allow(missing_docs)] | ||
| struct Blocking; | ||
| impl TaskKind for Blocking { | ||
| fn launch_task<S: SpawnNamed>(spawner: &mut S, name: &'static str, future: BoxFuture<'static, ()>) { | ||
| spawner.spawn_blocking(name, future) | ||
| fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) { | ||
| spawner.spawn(task_name, Some(subsystem_name), future) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -517,6 +525,7 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream { | |
| unbounded_meter: #support_crate ::metered::Meter, | ||
| ctx: Ctx, | ||
| s: SubSys, | ||
| subsystem_name: &'static str, | ||
| futures: &mut #support_crate ::FuturesUnordered<BoxFuture<'static, ::std::result::Result<(), #error_ty> >>, | ||
| ) -> ::std::result::Result<OverseenSubsystem<M>, #error_ty > | ||
| where | ||
|
|
@@ -540,7 +549,7 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream { | |
| let _ = tx.send(()); | ||
| }); | ||
|
|
||
| <TK as TaskKind>::launch_task(spawner, name, fut); | ||
| <TK as TaskKind>::launch_task(spawner, name, subsystem_name, fut); | ||
|
|
||
| futures.push(Box::pin( | ||
| rx.map(|e| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.