Gain intuition about the goings-on of your multithreaded/multicomponent programs

Overview

Intuition: a super simple profiler with a terminal ui based on tui-rs.

Gain intuition about the goings-on of your multithreaded/multicomponent programs.

Alt text

Intuition is a profiler that measures the average iteration time over time of a block of code. This block can be a single line or a block of code. In addition, every block you can emit its own compartmentalized logs.

Existing profilers that are either more fine/detailed or granular exist, but this offers a good balance of ease-of-use and utility. It is a rust pure rust library and uses the terminal for the gui so no external libraries are required.

This profiler in particular was built for quickly being able to gain an understanding of multicomponent, multitheaded systems during a spike in activity or over time (e.g. detecting some slowdown due to the growth of a data structure or a bounded mpsc channel filling up). Other profilers like coz are wonderful for causal profiling of steady state systems, but are a little harder to gain insight from more dynamic systems.

Example Usage

This example can be found in examples/simple.rs.

use intuition::{construct_profiler, Dash};

construct_profiler!(MyProgramProfiler for MyProgram: part_1);
const WINDOW_SIZE: usize = 100;
const AVERAGE_HISTORY_SIZE: usize = 1000;
static PROFILER: MyProgramProfiler<WINDOW_SIZE, AVERAGE_HISTORY_SIZE> = MyProgramProfiler::new();

fn main() {
    let mut dash = Dash::from_profiler(&PROFILER);

    let handle = std::thread::spawn(|| {
        let mut i: u64 = 0;
        loop {
            // do something before iteration which you don't want to time

            // Define a block to time
            let _new_i: u64 = PROFILER.part_1.iteration(|| {
                i += 1;
                i
            });

            // do something with result which you don't want to time
        }
    });

    let dash_handle =
        std::thread::spawn(
            move || match dash.run(std::time::Duration::from_millis(50)) {
                Ok(()) => (),
                Err(e) => println!("Dashboard exited with error {e:?}"),
            },
        );
    handle.join().unwrap();
    dash_handle.join().unwrap();
}

To quit the tui/dashboard, simply press q twice.

You might also like...
Some UwU and OwO for your Rust code

UwU Types Some UwU and OwO for your Rust code This is a Rust crate inspired by this tweet from @thingskatedid / @katef. Credits Some extra functionali

Notifications for your Argo Workflows.
Notifications for your Argo Workflows.

Hermes -- notifications for Argo Workflows Hermes aims to provide a streamlined way of sending notifications to various messaging services from your A

A complicated eso-lang written in Rust that doesn't limit your creativity!

Documentation for mott Introduction mott (from french "mot" = word) is (maybe) the first programming language, that doesn't limit your creativity to p

qfetch is a tool that fetches info about your linux install.

qfetch qfetch is a tool that fetches info about your linux install. Status Dependencies /proc/meminfo with the following fields: MemTotal in the 1st l

TypeRust - simple Rust playground where you can build or run your Rust code and share it with others

Rust playground Welcome to TypeRust! This is a simple Rust playground where you can build or run your Rust code and share it with others. There are a

Goodname is a tool to assist you with cool naming of your methods and software

Goodname is a tool to assist you with cool naming of your methods and software. Given a brief description of your method or software, this tool enumerates name candidates forming subsequences of the description (i.e., abbreviation).

A webapp that reads your articles to you while you're on the subway
A webapp that reads your articles to you while you're on the subway

ReadToMyShoe Video Demo A website that reads articles to you, even when you're offline. Still in early development. This is a full-stack Rust webapp,

Make your IDs strongly typed!!

About TypedId introduces a single type, aptly named TypedId. This is a generic wrapper any type, often types that you would use as an identifier. Howe

Send Youtube videos as audio podcasts to your personal Pocket Casts files section.

yttopocketcasts Send Youtube videos as audio podcasts to your personal Pocket Casts files section. Quick Start Prerequisites: Docker and Make must be

Owner
GenesysGo
GenesysGo
🕶 Assorted checks and validations for writing safer Solana programs.

vipers ?? Assorted checks and validations for writing safer Solana programs. Motivation Solana's fee mechanism is unlike Ethereum's, in that the numbe

Saber 131 Sep 14, 2022
Rust programs written entirely in Rust

mustang Programs written entirely in Rust Mustang is a system for building programs built entirely in Rust, meaning they do not depend on any part of

Dan Gohman 561 Dec 26, 2022
Complete code for the larger example programs from the book.

Code Examples for Programming Rust This repository contains complete code for the larger example programs from the book “Programming Rust”, by Jim Bla

Programming Rust 670 Jan 1, 2023
Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

co-rs 47 Nov 17, 2022
Write Anchor-compatible Solana programs in Python

seahorse: Write Solana programs in Python The ease of Python with the safety of Rust. Seahorse lets you write Solana programs in Python. It is a commu

✨ amelia chen ✨ 214 Dec 28, 2022
Small programs written in Rust. Warm up for the upcoming Selenium Manager

Rust Examples This repository contains several example programs written in Rust. Selenium Manager These examples are used as warm up for the upcoming

Boni García 5 Dec 30, 2022
A additional Rust compiler pass to detect memory safe bugs of Rust programs.

SafeDrop A additional Rust compiler pass to detect memory safe bugs of Rust programs. SafeDrop performs path-sensitive and field-sensitive inter-proce

Artisan-Lab  (Fn*) 5 Nov 25, 2022
Rust library for compiling and running other programs.

Exers ?? Exers is a rust library for compiling and running code in different languages and runtimes. Usage example fn main() { // Imports...

olix3001 5 Jun 10, 2023
A cli tool to write your idea in terminal

Ideas ideas is a cli tools to write your idea in your terminal. Demo Features tagged idea, contains tips, idea, todo status switch ascii icon write yo

王祎 12 Jun 22, 2022
Take your first step in writing a compiler. Implemented in Rust.

first-step-rust Take your first step in writing a compiler, using Rust. Building from Source Make sure the Rust toolchain is installed on your compute

PKU Compiler Course 13 Aug 28, 2022