goschedviz

πŸ“Š Terminal-based Go scheduler visualization tool with real-time metrics, charts and insights

https://github.com/justskiv/goschedviz

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • βœ“
    CITATION.cff file
    Found CITATION.cff file
  • βœ“
    codemeta.json file
    Found codemeta.json file
  • βœ“
    .zenodo.json file
    Found .zenodo.json file
  • β—‹
    DOI references
  • β—‹
    Academic publication links
  • β—‹
    Academic email domains
  • β—‹
    Institutional organization owner
  • β—‹
    JOSS paper metadata
  • β—‹
    Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

πŸ“Š Terminal-based Go scheduler visualization tool with real-time metrics, charts and insights

Basic Info
  • Host: GitHub
  • Owner: JustSkiv
  • License: mit
  • Language: Go
  • Default Branch: main
  • Homepage:
  • Size: 7.97 MB
Statistics
  • Stars: 286
  • Watchers: 2
  • Forks: 3
  • Open Issues: 1
  • Releases: 6
Created about 1 year ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License Citation

README.md

goschedviz β€” Go Scheduler Visualizer

Build Status Go Reference Release Telegram

Go Report Card codecov Coverage Status

Read this in other languages: Русский

A terminal-based visualization tool for the Go runtime scheduler. This tool helps understand Go's scheduler behavior by providing real-time metrics visualization.

Demo Screenshot Placeholder

⚠️ Important Note: This tool is for educational purposes only. It's designed to help understand Go scheduler behavior and should not be used in production environments or critical projects. It may contain bugs and is not optimized for performance.

Features

  • Real-time monitoring of Go scheduler metrics using GODEBUG schedtrace
  • Goroutines count monitoring through runtime metrics
  • Terminal UI with multiple visualization widgets:
    • Current scheduler values table
    • Local Run Queue bar chart
    • Gauges for GRQ, Goroutines, Threads and Idle Processors
    • Dual history plots (linear and logarithmic scales)
    • Color-coded metrics legend
  • Support for any Go program as monitoring target

Installation

Option 1: From source

Clone and build the project:

bash git clone https://github.com/JustSkiv/goschedviz cd goschedviz make build

The binary will be created in the bin directory.

Option 2: Using go install

bash go install github.com/JustSkiv/goschedviz/cmd/goschedviz@latest

This will install the goschedviz binary in your $GOPATH/bin directory. Make sure this directory is in your PATH.

Usage

Basic Usage

bash goschedviz -target=/path/to/your/program.go -period=1000

Where:

  • -target: Path to Go program to monitor
  • -period: GODEBUG schedtrace period in milliseconds (default: 1000)

Adding Goroutines Metrics to Your Program

To enable goroutines count monitoring, add the metrics reporter to your program:

```go package main

import ( "time" "github.com/JustSkiv/goschedviz/pkg/metrics" )

func main() { // Initialize metrics reporter reporter := metrics.NewReporter(time.Second) reporter.Start() defer reporter.Stop()

// Your program logic here
...

} ```

The reporter will automatically export goroutines count metrics that will be picked up by goschedviz.

Controls

  • q or Ctrl+C: Exit the program
  • Terminal resize is supported

Example

  1. Create a simple test program (example.go):

```go package main

import "time"

func main() { // Create some scheduler load for i := 0; i < 1000; i++ { go func() { time.Sleep(time.Second) }() } time.Sleep(10 * time.Second) } ```

  1. Run visualization:

bash goschedviz -target=example.go

Or try provided example:

```bash

Simple CPU-intensive example with GOMAXPROCS=2 and a lot of goroutines

goschedviz -target=examples/simple/main.go ```

You are welcome to contribute your own demonstrative examples. Examples that show different scheduler behaviors are especially valuable (see Contributing for details).

Good examples could demonstrate:

  • Heavy computation vs I/O workloads
  • Different GOMAXPROCS configurations
  • Network-bound applications
  • Memory-intensive operations
  • Specific scheduler patterns or edge cases

This helps others learn about Go scheduler behavior in different scenarios.

Understanding the Output

The UI shows several key metrics:

  • Current Values Table: Shows current scheduler state including GOMAXPROCS, threads count, etc.
  • Local Run Queue Bars: Visualizes queue length for each P (processor)
  • Metric Gauges:
    • GRQ (Global Run Queue) length
    • Active goroutines count
    • System threads count
    • Idle processors count
  • History Plots:
    • Linear scale plot for precise value tracking
    • Logarithmic scale plot for better visualization of large ranges
  • Legend: Color-coded guide for metrics identification in plots:
    • GRQ - Global Run Queue (green)
    • LRQ - Local Run Queues sum (magenta)
    • THR - OS Threads (red)
    • IDL - Idle Processors (yellow)
    • GRT - Goroutines (cyan)

How It Works

The tool:

  1. Runs your Go program with GODEBUG=schedtrace enabled
  2. Parses scheduler trace output in real-time
  3. Collects additional runtime metrics (goroutines count)
  4. Visualizes all metrics using a terminal UI

Requirements

  • Go 1.23 or later
  • Unix-like operating system (Linux, macOS)
  • Terminal with colors support

Development

```bash

Build the project

make build

Run tests

make test

Clean build artifacts

make clean ```

Author's Resources

Contributing

Contributions are welcome! Whether you're fixing bugs, improving documentation, or adding new features, your help is appreciated.

If you're new to open source or Go development, this project is a great place to start. Check out our contribution guide for:

  • Step-by-step instructions for making your first contribution
  • Development environment setup
  • Code style guidelines
  • Types of contributions needed
  • Community guidelines

Don't hesitate to ask questions - we're here to help you learn!

Citation

If you use goschedviz in your project, research or educational materials, please consider mentioning or citing it:

This project uses goschedviz (https://github.com/JustSkiv/goschedviz) by Nikolay Tuzov

License

MIT License - see LICENSE file for details.

Owner

  • Name: Nikolay Tuzov
  • Login: JustSkiv
  • Kind: user

Senior Developer

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use goschedviz in your project or research, please cite it using these metadata."
authors:
  - family-names: "Tuzov"
    given-names: "Nikolay"
title: "goschedviz"
version: 0.0.1
date-released: 2024-02-12
url: "https://github.com/JustSkiv/goschedviz"
repository-code: "https://github.com/JustSkiv/goschedviz"
abstract: "A terminal-based visualization tool for the Go runtime scheduler that provides real-time metrics and insights into scheduler behavior."
keywords:
  - go
  - scheduler
  - visualization
  - metrics
  - terminal-ui
license: MIT

GitHub Events

Total
  • Create event: 9
  • Issues event: 1
  • Release event: 6
  • Watch event: 264
  • Issue comment event: 1
  • Push event: 30
  • Fork event: 4
Last Year
  • Create event: 9
  • Issues event: 1
  • Release event: 6
  • Watch event: 264
  • Issue comment event: 1
  • Push event: 30
  • Fork event: 4

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 12
proxy.golang.org: github.com/justskiv/goschedviz
  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.7%
Average: 5.9%
Dependent repos count: 6.1%
Last synced: 7 months ago
proxy.golang.org: github.com/JustSkiv/goschedviz
  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.7%
Average: 5.9%
Dependent repos count: 6.1%
Last synced: 7 months ago

Dependencies

go.mod go
  • github.com/davecgh/go-spew v1.1.1
  • github.com/gizak/termui/v3 v3.1.0
  • github.com/mattn/go-runewidth v0.0.2
  • github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7
  • github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/stretchr/testify v1.10.0
  • gopkg.in/yaml.v3 v3.0.1
go.sum go
  • github.com/davecgh/go-spew v1.1.1
  • github.com/gizak/termui/v3 v3.1.0
  • github.com/mattn/go-runewidth v0.0.2
  • github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7
  • github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/stretchr/testify v1.10.0
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/yaml.v3 v3.0.1