Skip to main content
Help improve this documentation

This documentation is still new and evolving. If you spot any mistakes, unclear explanations, or missing details, please open an issue.

Your feedback helps us improve!

samber/psi operatorsโ€‹

This page lists all operators available in the samber/psi sub-package of ro.

Installโ€‹

First, import the sub-package in your project:

go get -u github.com/samber/ro/plugins/samber/psi
  • NewPSINotifierโ€‹

    Creates PSI (Pressure Stall Information) notifier.

    import (
    "time"

    "github.com/samber/ro"
    ropsi "github.com/samber/ro/plugins/samber/psi"
    "github.com/shirou/gopsutil/v3/psinotifier"
    )

    obs := ropsi.NewPSINotifier(1 * time.Second)

    sub := obs.Subscribe(ro.PrintObserver[psinotifier.PSIStatsResource]())
    defer sub.Unsubscribe()

    // Next: {Resource: "cpu", Avg10: 0.1, Avg60: 0.05, Avg300: 0.01, Total: 1000}
    // Next: {Resource: "memory", Avg10: 0.2, Avg60: 0.1, Avg300: 0.05, Total: 2000}
    // ...
    Prototype:
    func NewPSINotifier(interval time.Duration)