-
Notifications
You must be signed in to change notification settings - Fork 731
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
core, tracing: don't inline dispatcher::get_default #994
Merged
Conversation
This file contains 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
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added
crate/core
Related to the `tracing-core` crate
crate/tracing
Related to the `tracing` crate
labels
Sep 28, 2020
LucioFranco
approved these changes
Sep 28, 2020
hawkw
added a commit
that referenced
this pull request
Sep 28, 2020
Fixed - Incorrect inlining of `Event::dispatch` and `Event::child_of`, which could result in `dispatcher::get_default` being inlined at the callsite (#994) Added - `Copy` implementations for `Level` and `LevelFilter` (#992) Thanks to new contributors @jyn514 and @TaKO8Ki for contributing to this release! Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added a commit
that referenced
this pull request
Sep 28, 2020
### Fixed - Incorrect inlining of `Event::dispatch` and `Event::child_of`, which could result in `dispatcher::get_default` being inlined at the callsite (#994) ### Added - `Copy` implementations for `Level` and `LevelFilter` (#992) Thanks to new contributors @jyn514 and @TaKO8Ki for contributing to this release! Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added a commit
that referenced
this pull request
Sep 28, 2020
Fixed - Incorrect inlining of `Span::new`, `Span::new_root`, and `Span::new_child_of`, which could result in `dispatcher::get_default` being inlined at the callsite ([#994]) - Regression where using a struct field as a span or event field when other fields on that struct are borrowed mutably would fail to compile ([#987]) Changed - Updated `tracing-core` to 0.1.17 ([#992]) Added - `Instrument` trait and `Instrumented` type for attaching a `Span` to a `Future` ([#808]) - `Copy` implementations for `Level` and `LevelFilter` ([#992]) - Multiple documentation fixes and improvements ([#964], [#980], [#981]) Thanks to @nagisa, and new contributors @securityinsanity, @froydnj, @jyn514 and @TaKO8Ki for contributing to this release! [#994]: #994 [#992]: #992 [#987]: #987 [#980]: #980 [#981]: #981 [#964]: #964 [#808]: #808 Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added a commit
that referenced
this pull request
Sep 28, 2020
### Fixed - Incorrect inlining of `Span::new`, `Span::new_root`, and `Span::new_child_of`, which could result in `dispatcher::get_default` being inlined at the callsite ([#994]) - Regression where using a struct field as a span or event field when other fields on that struct are borrowed mutably would fail to compile ([#987]) ### Changed - Updated `tracing-core` to 0.1.17 ([#992]) ### Added - `Instrument` trait and `Instrumented` type for attaching a `Span` to a `Future` ([#808]) - `Copy` implementations for `Level` and `LevelFilter` ([#992]) - Multiple documentation fixes and improvements ([#964], [#980], [#981]) Thanks to @nagisa, and new contributors @securityinsanity, @froydnj, @jyn514 and @TaKO8Ki for contributing to this release! [#994]: #994 [#992]: #992 [#987]: #987 [#980]: #980 [#981]: #981 [#964]: #964 [#808]: #808 Signed-off-by: Eliza Weisman <eliza@buoyant.io>
dvdplm
added a commit
to dvdplm/tracing
that referenced
this pull request
Oct 7, 2020
* upstream/master: subscriber: warn if trying to enable a statically disabled level (tokio-rs#990) subscriber: use macros for module declarations (tokio-rs#1009) chore: remove `stdlib.rs` (tokio-rs#1008) core: fix linked list tests reusing `Registration`s (tokio-rs#1016) subscriber: support dash in target names (tokio-rs#1012) docs: switch to intra-doc links in tracing-core (tokio-rs#1010) tracing-opentelemetry: implement additional record types (bool, i64, u64) (tokio-rs#1007) core: add intrusive linked list for callsite registry (tokio-rs#988) serde: allow tracing-serde to work on no_std. (tokio-rs#960) tracing: remove `Into<Option<Id>>` impl for `Span` (tokio-rs#1003) tracing: make `Entered` `!Send` (tokio-rs#1001) chore: fix nightly clippy warnings (tokio-rs#991) chore: bump all crate versions (tokio-rs#998) macros: fix the `tracing-macros` crate not compiling (tokio-rs#1000) tracing: prepare to release 0.1.21 (tokio-rs#997) core: prepare to release 0.1.17 (tokio-rs#996) subscriber: make `PartialOrd` & `Ord` impls more correct (tokio-rs#995) core, tracing: don't inline dispatcher::get_default (tokio-rs#994) core: make `Level` and `LevelFilter` `Copy` (tokio-rs#992)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Motivation
Presently, functions for recording new spans and events that can get the
current dispatcher (
Event::dispatch
,Event::child_of
,Span::new
,and
Span::new_root
) are marked as#[inline]
. This results in thesemethods getting inlined in most cases, and
dispatcher::get_default
issometimes inlined into those methods. This, then, inlines all of
dispatcher::get_default
into the callsites of thespan!
andevent!
macros, generating way too much code (including thread local accesses)
inline. Since there's an
expect
inget_default
, this also means thatunwinding code is inlined into functions that wouldn't otherwise panic,
which is also not great. Inlining too much code this results in code that
optimizes poorly in many cases.
Solution
This PR removes
#[inline]
attributes from these functions, ensuringthat the TLS hits are always behind a function call.