forked from mtusi2026/mtusi2026lab4
ЛР4: MinIO, вложения и reconciler на оценку 5
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"time"
|
||||
"golang.org/x/crypto/argon2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
samples:=[]float64{}
|
||||
for i:=0;i<5;i++ {
|
||||
start:=time.Now()
|
||||
hash:=argon2.IDKey([]byte("synthetic-diagnostic-password"),[]byte("synthetic-salt12"),3,64*1024,1,32)
|
||||
runtime.KeepAlive(hash)
|
||||
samples=append(samples,float64(time.Since(start).Microseconds())/1000)
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
stats,_:=os.ReadFile("/sys/fs/cgroup/cpu.stat")
|
||||
json.NewEncoder(os.Stdout).Encode(map[string]any{"kdf_ms":samples,"cpu_stat":string(stats),"gomaxprocs":runtime.GOMAXPROCS(0)})
|
||||
}
|
||||
Reference in New Issue
Block a user