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

improve LOOM_LOG tracing #266

Merged
merged 2 commits into from
May 4, 2022
Merged

improve LOOM_LOG tracing #266

merged 2 commits into from
May 4, 2022

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented May 4, 2022

This branch makes a few minor improvements to how Loom uses tracing to
generate LOOM_LOG output:

  • Added with_test_writer to the tracing subscriber. This allows logs
    written by Loom to be captured by libtest. This way, running Loom
    tests with --show-output will print the LOOM_LOG output from each
    test under that test's heading. Similarly, this allows libtest to
    capture Loom log output by default, and print the output back for
    failed tests.

  • Updated to the latest tracing-subscriber version. This gets us
    slightly nicer-looking formatting but is otherwise not that important.

  • Added tracing spans for each simulated Loom thread. Now, when we
    switch threads, we also switch to that thread's corresponding
    tracing span. This way, all output in the log is annotated with the
    current thread's name, which should help improve debuggability a bit.

  • Added a tracing span with the model's current iteration. This should
    make it much easier to distinguish when a new iteration has started,
    while reading the logs.

Examples

Current master. Note how the log output from all tests is mushed
together, and is not captured by libtest:
image

This branch. Note how all tracing events are now annotated with
the thread ID and the current iteration, and how libtest is able to
capture output and separate it by which test emitted it:
image

@hawkw hawkw requested review from carllerche and Darksonn May 4, 2022 19:12
Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

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

🔨

@hawkw hawkw enabled auto-merge (squash) May 4, 2022 19:16
@hawkw hawkw merged commit a58856c into master May 4, 2022
@hawkw hawkw deleted the eliza/nicer-tracing branch May 4, 2022 19:18
hawkw added a commit that referenced this pull request May 9, 2022
This commit adds a `tracing` span with the current model's iteration
that's entered every time an iteration begins. This should make it much
easier to distinguish individual iterations in the `LOOM_LOG` output.

This was supposed to be part of #266 (and I discussed it in the PR
description for that branch) but I forgot to push this commit. Whoops.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request May 10, 2022
# 0.5.5 (May 10, 2022)

### Added

- sync: Add `Arc::from_std` without `T: Sized` bound (#226)
- sync: Implement `Debug` for `AtomicPtr` for all `T` (#255)
- logs: Add location tracking for threads and atomic operations (#258)
- logs: Add additional location tracking to `Arc`, `alloc`, and `mpsc`
  (#265)
- logs: Improve `tracing` configuration for `LOOM_LOG` (#266)
- logs: Add a span for the current model's iteration (#267)

### Documented

- Add note about in-memory representation of atomic types (#253)
- Document `LOOM_LOG` syntax (#257)

### Fixed

- Fix double panic when exceeding the branch limit in `Drop` (#245)
- cell: Allow using `{Mut,Const}Ptr::{deref,with}` when the pointee is
  `!Sized` (#247)
- thread: Fix semantics of `thread::park` after `Thread::unpark` (#250)
@hawkw hawkw mentioned this pull request May 10, 2022
hawkw added a commit that referenced this pull request May 13, 2022
# 0.5.5 (May 10, 2022)

### Added

- sync: Add `Arc::from_std` without `T: Sized` bound (#226)
- sync: Implement `Debug` for `AtomicPtr` for all `T` (#255)
- logs: Add location tracking for threads and atomic operations (#258)
- logs: Add additional location tracking to `Arc`, `alloc`, and `mpsc`
  (#265)
- logs: Improve `tracing` configuration for `LOOM_LOG` (#266)
- logs: Add a span for the current model's iteration (#267)

### Documented

- Add note about in-memory representation of atomic types (#253)
- Document `LOOM_LOG` syntax (#257)

### Fixed

- Fix double panic when exceeding the branch limit in `Drop` (#245)
- cell: Allow using `{Mut,Const}Ptr::{deref,with}` when the pointee is
  `!Sized` (#247)
- thread: Fix semantics of `thread::park` after `Thread::unpark` (#250)
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.

2 participants