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

Task accounting statistics #2931

Closed
bblum opened this issue Jul 16, 2012 · 15 comments
Closed

Task accounting statistics #2931

bblum opened this issue Jul 16, 2012 · 15 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@bblum
Copy link
Contributor

bblum commented Jul 16, 2012

It would be cool if the scheduler exposed statistics about tasks. Currently all I have in mind is time alive / time on CPU / time blocked.

@eholk
Copy link
Contributor

eholk commented Jul 16, 2012

It'd also be nice to be able to give tasks names.

@bblum
Copy link
Contributor Author

bblum commented Jul 16, 2012

oh, yeah, there's a hole for that already in the runtime code, just no way to do it.

@eholk
Copy link
Contributor

eholk commented Jul 16, 2012

Yeah, ideally we'd have task::set_name, but then we have to deal with passing strings to the runtime. It's not hard, but it's always enough to discourage me from it.

@bblum
Copy link
Contributor Author

bblum commented Jul 16, 2012

as_c_str, and strcpy on the runtime side? (well, strdup, probably)

@eholk
Copy link
Contributor

eholk commented Jul 17, 2012

I think that's basically it.

@bblum
Copy link
Contributor Author

bblum commented Jul 17, 2012

hey @eholk, what do you think of this scary comment in rust_task.h?

// Only a pointer to 'name' is kept, so it must live as long as this task.

EDIT: it's ok as is, because the only args are ever "main" or NULL. it's just hinting that it needs a strdup.

@eholk
Copy link
Contributor

eholk commented Jul 18, 2012

Yeah, I was thinking maybe just allocate a fixed sized char buffer and copy the string into it.

@graydon
Copy link
Contributor

graydon commented May 8, 2013

still valid, and I think important enough for production use (accounting / profiling of tasks in general) that I'm going to nominate for production ready.

@brson
Copy link
Contributor

brson commented May 16, 2013

Some stats relevant to the new scheduler:

  • Sends - can either rendezvous with the receiving task and context switch immediately or not
  • Receive - can either block or not
  • Work stealing - how many times schedulers become stealers, and how often this is successful
  • I/O - how often outstanding I/O forces the scheduler to go into slower scheduling modes
  • I/O affinity - how often tasks must be sent to other threads to satisfy I/O

@graydon
Copy link
Contributor

graydon commented Jun 6, 2013

accepted for well-covered milestone

@graydon
Copy link
Contributor

graydon commented Jun 28, 2013

See also #6810

@catamorphism
Copy link
Contributor

Re-nominating in order to de-milestone this; we're trying to cut back the milestones to a more manageable size and this doesn't seem like a blocker to me.

@catamorphism
Copy link
Contributor

Just a bug, de-milestoning

@reem
Copy link
Contributor

reem commented Sep 3, 2014

Triage bump, fixed according to #2891

@thestinger
Copy link
Contributor

#17325 means this isn't relevant to the standard libraries anymore. The usual profiling tools can be used with native threads and the libraries themselves won't have the necessary information.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Nov 12, 2023
Treat thread-local statics on main thread as static roots for leakage analysis

Miri currently treats allocations as leaked if they're only referenced in thread-local statics. For threads other than the main thread, this is correct, since the thread can terminate before the program does, but references in the main thread's locals should be treated as living for the duration of the program since the thread lives for the duration of the program.

This PR adds thread-local statics and TLS keys as "static roots" for leakage analysis, but does not yet bless the example program from rust-lang#2881. See rust-lang/miri#2881 (comment)

Closes rust-lang#2881
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
…eMIR (rust-lang#2931)

Migrate most of the operand code generation to use StableMIR APIs, and
static handling.

This change is so far the one that required some re-work, since
constants in StableMIR differ a bit from internal APIs. In the Rust
compiler internal APIs, constant values can be using either: Scalar,
Slice, Indirect (represented by an Allocation), and ZST. In the
StableAPIs, a constant value is always represented with an Allocation.

To avoid making changes to the final gotoc, we generate code for
allocations in two steps, we first try to generate just a regular
constant literal if the constant is small (similar logic to handling the
Scalar internal type).

For more complex cases, we create an allocation and read from it,
similar to how Indirect / Slice internal handling used to work.

---------

Co-authored-by: Zyad Hassan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

7 participants