From 8ea20cd205a32f22a1f267bf61efc487db2e6b8b Mon Sep 17 00:00:00 2001 From: John Jolly Date: Sun, 16 Apr 2023 19:43:25 -0600 Subject: [PATCH] Add output for threadcount and key generation time to cmd/genkey This change is to display information about the key generation process. Specifically, two bits of information are now displayed * The number of threads created to search for keys, and * The time taken to generate a successful "next best" key --- cmd/genkeys/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/genkeys/main.go b/cmd/genkeys/main.go index a12d303e..36107c0a 100644 --- a/cmd/genkeys/main.go +++ b/cmd/genkeys/main.go @@ -16,6 +16,7 @@ import ( "fmt" "net" "runtime" + "time" "github.com/yggdrasil-network/yggdrasil-go/src/address" ) @@ -27,6 +28,8 @@ type keySet struct { func main() { threads := runtime.GOMAXPROCS(0) + fmt.Println("Threads:", threads) + start := time.Now() var currentBest ed25519.PublicKey newKeys := make(chan keySet, threads) for i := 0; i < threads; i++ { @@ -36,7 +39,7 @@ func main() { newKey := <-newKeys if isBetter(currentBest, newKey.pub) || len(currentBest) == 0 { currentBest = newKey.pub - fmt.Println("-----") + fmt.Println("-----", time.Since(start)) fmt.Println("Priv:", hex.EncodeToString(newKey.priv)) fmt.Println("Pub:", hex.EncodeToString(newKey.pub)) addr := address.AddrForKey(newKey.pub)