Skip to content
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

wait time as a span #19

Merged
merged 18 commits into from
Jul 30, 2020
Merged

wait time as a span #19

merged 18 commits into from
Jul 30, 2020

Conversation

zhongzc
Copy link
Collaborator

@zhongzc zhongzc commented Jul 23, 2020

Signed-off-by: zhongzc zhongzc_arch@outlook.com

Changes:

  • One-dimensionalize spans. Remove span_sets in TraceDetails:
- pub span_sets: Vec<SpanSet>
+ pub spans: Vec<Span>,
+ pub properties: Properties,
  • Introduce more relations naming State between spans: State::Root, State::Settle, State::Local, State::Spawning, State::Scheduling. Root, Spawning and Scheduling are spans which indicate waiting for execution.
  • Treeize trace results in tests then more reasonable test cases can be written.

Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
@zhongzc zhongzc marked this pull request as ready for review July 29, 2020 07:34
@zhongzc zhongzc requested a review from Renkai July 29, 2020 07:34
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
src/collector.rs Outdated Show resolved Hide resolved
@@ -46,6 +88,6 @@ impl Drop for Collector {
fn drop(&mut self) {
self.inner
.closed
.store(true, std::sync::atomic::Ordering::SeqCst);
.store(true, std::sync::atomic::Ordering::Relaxed);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any explanation about why Relaxed is enough now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ordering is about two or more shared variables among multiple threads. If we don't have that synchronization semantics, relaxed is enough.

src/lib.rs Show resolved Hide resolved
@@ -42,14 +42,12 @@ static GLOBAL_ID_COUNTER: std::sync::atomic::AtomicU32 = std::sync::atomic::Atom

#[inline]
fn next_global_id_prefix() -> u32 {
GLOBAL_ID_COUNTER.fetch_add(1, std::sync::atomic::Ordering::SeqCst)
GLOBAL_ID_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

// fill the elapsed cycles of the first span
tl.spans[self.span_start_index].elapsed_cycles =
minstant::now().saturating_sub(tl.spans[self.span_start_index].begin_cycles);
// fill the elapsed cycles of the first span (except the leading span)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any explanation about why created a new concept LeadingSpan and change logic here?

Copy link
Collaborator Author

@zhongzc zhongzc Jul 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A leading span is one of Root, Spawning, and Scheduling, which represents how a tracing context creates.

The elapsed time of a leading span means how long it waits from creating the task to starting execution.

A Settle span means the execution is starting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A leading span is one of Root, Spawning, and Scheduling, which represents how a tracing context creates.

The elapsed time of a leading span means how long it waits from creating the task to starting execution.

A Settle span means the execution is starting.

Maybe this response can add to the comments in L142

Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>
@Renkai Renkai self-requested a review July 30, 2020 14:32
@zhongzc zhongzc merged commit 6f6750f into master Jul 30, 2020
@zhongzc zhongzc deleted the unify-wait-span branch July 30, 2020 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants