Skip to content

Wraps around a futures::task::Spawn and adds diagnostics to it

License

Notifications You must be signed in to change notification settings

tomaka/futures-diagnose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This crate allows one to generate logs about how tasks are scheduled, in order to generate a profile of the CPU usage of the binary.

This crate leverages https://github.com/catapult-project/catapult/tree/11513e359cd60e369bbbd1f4f2ef648c1bccabd0/tracing

Usage

First, import the traits:

use futures_diagnose_exec::{FutureExt as _, Future01Ext as _};

Then whenever you create a Future, append .with_diagnostics("name"). For example:

async_std::spawn(future.with_diagnostics("my-task-name"))

Set the environment variable PROFILE_DIR to a directory of your choice (e.g. profile) and then, run your code. Files named profile.<pid>.<num>.json will be generated in the directory set beforehand.

Then, open Chrome and go to the URL chrome://tracing, and load the profile.json.

FAQ

  • Chrome tells me chrome://tracing "can't be reached".

    Chromium shipped with recent Debian versions has the tracing feature disabled. See the Debian bug report for details.

About

Wraps around a futures::task::Spawn and adds diagnostics to it

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages