Skip to content

Instantly share code, notes, and snippets.

@benmoss
Last active June 16, 2022 16:53
Show Gist options
  • Save benmoss/e999764db7e036586c9abc20e515d076 to your computer and use it in GitHub Desktop.
Save benmoss/e999764db7e036586c9abc20e515d076 to your computer and use it in GitHub Desktop.
diff --git a/cmd/imgpkg/imgpkg.go b/cmd/imgpkg/imgpkg.go
index 4d1ae1f..a025c5a 100644
--- a/cmd/imgpkg/imgpkg.go
+++ b/cmd/imgpkg/imgpkg.go
@@ -8,6 +8,8 @@ import (
"log"
"math/rand"
"os"
+ "runtime"
+ "runtime/pprof"
"time"
uierrs "github.com/cppforlife/go-cli-ui/errors"
@@ -26,6 +28,9 @@ func main() {
confUI := ui.NewConfUI(ui.NewNoopLogger())
defer confUI.Flush()
+ runtime.SetBlockProfileRate(100_000_000) // WARNING: Can cause some CPU overhead
+ file, _ := os.Create("./block.pprof")
+ defer pprof.Lookup("block").WriteTo(file, 0)
command := cmd.NewDefaultImgpkgCmd(confUI)
err := command.Execute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment