sapling/lib/stackdesc
Jun Wu 8315564c33 stackdesc: a thin library to annotate the current thread execution
Summary:
Add a thin library to store a side-by-side "stack" that can provide chainned
human-friendly context information. Right now, it only works with the current
native thread. It can be thought of an "annotation" of the native stack.

The concept is useful for both Python and Rust. So this diff adds a Rust
implementation, and a Python binding will be added as follow-up.

This diff only implements the minimal bits to make it useful. Some future
possibilities are:

- Have a way to collect information from all threads. This requires a global
  state and customized thread spawn / join wrappers.
- Have a way to "request" for the "stack description" from another thread.
  This might be useful for progress-bar use-case, where the progress bar
  logic runs in a different thread.

Note: I searched through `crates.io` for something similar. But I couldn't find
any. They are either coupled with error handling that will miss the "explain
why this prefetch happens" case, or are not lazy, which is undesirable as I'd
imagine some context to have complex logic like rendering a DAG graph.

Reviewed By: sfilipco

Differential Revision: D16023308

fbshipit-source-id: 320a23447dea85089ba8ab02436af3ec93466dd8
2019-08-01 19:53:56 -07:00
..
src stackdesc: a thin library to annotate the current thread execution 2019-08-01 19:53:56 -07:00
Cargo.toml stackdesc: a thin library to annotate the current thread execution 2019-08-01 19:53:56 -07:00