test: Report time per MiB on transfer benchs (#5711)
This commit is contained in:
parent
cc36621b11
commit
1df8701c46
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestBenchmarkTransferManyFiles(t *testing.T) {
|
func TestBenchmarkTransferManyFiles(t *testing.T) {
|
||||||
benchmarkTransfer(t, 50000, 15)
|
benchmarkTransfer(t, 10000, 15)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBenchmarkTransferLargeFile1G(t *testing.T) {
|
func TestBenchmarkTransferLargeFile1G(t *testing.T) {
|
||||||
@ -154,9 +154,9 @@ loop:
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Result: Wall time:", t1.Sub(t0))
|
log.Printf("Result: Wall time: %v / MiB", t1.Sub(t0)/time.Duration(total/1024/1024))
|
||||||
log.Printf("Result: %.1f MiB/s synced", float64(total)/1024/1024/t1.Sub(t0).Seconds())
|
log.Printf("Result: %.3g KiB/s synced", float64(total)/1024/t1.Sub(t0).Seconds())
|
||||||
|
|
||||||
printUsage("Receiver", recvProc)
|
printUsage("Receiver", recvProc, total)
|
||||||
printUsage("Sender", sendProc)
|
printUsage("Sender", sendProc, total)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,10 +16,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func printUsage(name string, proc *os.ProcessState) {
|
func printUsage(name string, proc *os.ProcessState, total int64) {
|
||||||
if rusage, ok := proc.SysUsage().(*syscall.Rusage); ok {
|
if rusage, ok := proc.SysUsage().(*syscall.Rusage); ok {
|
||||||
log.Printf("%s: Utime: %s", name, time.Duration(rusage.Utime.Nano()))
|
mib := total / 1024 / 1024
|
||||||
log.Printf("%s: Stime: %s", name, time.Duration(rusage.Stime.Nano()))
|
log.Printf("%s: Utime: %s / MiB", name, time.Duration(rusage.Utime.Nano()/mib))
|
||||||
|
log.Printf("%s: Stime: %s / MiB", name, time.Duration(rusage.Stime.Nano()/mib))
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
// Darwin reports in bytes, Linux seems to report in KiB even
|
// Darwin reports in bytes, Linux seems to report in KiB even
|
||||||
// though the manpage says otherwise.
|
// though the manpage says otherwise.
|
||||||
|
|||||||
@ -20,9 +20,10 @@ func ftToDuration(ft *syscall.Filetime) time.Duration {
|
|||||||
return time.Duration(n*100) * time.Nanosecond
|
return time.Duration(n*100) * time.Nanosecond
|
||||||
}
|
}
|
||||||
|
|
||||||
func printUsage(name string, proc *os.ProcessState) {
|
func printUsage(name string, proc *os.ProcessState, total int64) {
|
||||||
if rusage, ok := proc.SysUsage().(*syscall.Rusage); ok {
|
if rusage, ok := proc.SysUsage().(*syscall.Rusage); ok {
|
||||||
log.Printf("%s: Utime: %s", name, ftToDuration(&rusage.UserTime))
|
mib := total / 1024 / 1024
|
||||||
log.Printf("%s: Stime: %s", name, ftToDuration(&rusage.KernelTime))
|
log.Printf("%s: Utime: %s / MiB", name, time.Duration(&rusage.UserTime/mib))
|
||||||
|
log.Printf("%s: Stime: %s / MiB", name, time.Duration(&rusage.KernelTime/mib))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user