Skip to content

Instantly share code, notes, and snippets.

@skaji
Created June 27, 2023 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skaji/52806a2a93dc5ebcdf981f61118d7732 to your computer and use it in GitHub Desktop.
Save skaji/52806a2a93dc5ebcdf981f61118d7732 to your computer and use it in GitHub Desktop.
go-cpu -d 3us
package main
import (
"flag"
"fmt"
"time"
)
func main() {
var duration time.Duration
flag.DurationVar(&duration, "d", time.Millisecond, "")
flag.Parse()
fmt.Println("sleep", duration)
i := 0
for {
time.Sleep(duration)
i++
i = i % 10
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment