Commit d0bfebb3 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Print latency stats nicely.

parent f819c7aa
...@@ -9,8 +9,23 @@ import ( ...@@ -9,8 +9,23 @@ import (
"os" "os"
"flag" "flag"
"runtime" "runtime"
"sort"
) )
func PrintMap(m map[string]float64) {
keys := make([]string, len(m))
for k, _ := range m {
keys = append(keys, k)
}
sort.SortStrings(keys)
for _, k := range keys {
if m[k] > 0 {
fmt.Println(k, m[k])
}
}
}
func main() { func main() {
// Scans the arg list and sets up flags // Scans the arg list and sets up flags
debug := flag.Bool("debug", false, "print debugging messages.") debug := flag.Bool("debug", false, "print debugging messages.")
...@@ -35,7 +50,9 @@ func main() { ...@@ -35,7 +50,9 @@ func main() {
fs.SetOptions(&opts) fs.SetOptions(&opts)
conn := fuse.NewPathFileSystemConnector(timing) conn := fuse.NewPathFileSystemConnector(timing)
state := fuse.NewMountState(conn) rawTiming := fuse.NewTimingRawFilesystem(conn)
state := fuse.NewMountState(rawTiming)
state.Debug = *debug state.Debug = *debug
mountPoint := flag.Arg(1) mountPoint := flag.Arg(1)
...@@ -56,12 +73,15 @@ func main() { ...@@ -56,12 +73,15 @@ func main() {
fmt.Println("Finished", state.Stats()) fmt.Println("Finished", state.Stats())
counts := state.OperationCounts() counts := state.OperationCounts()
fmt.Println("Counts: ", counts) fmt.Println("Counts: ", counts)
latency := state.Latencies() latency := state.Latencies()
fmt.Println("Latency (ms):", latency) fmt.Println("MountState latency (ms):")
PrintMap(latency)
latency = timing.Latencies() latency = timing.Latencies()
fmt.Println("Path ops (ms):", latency) fmt.Println("Path ops (ms):", latency)
latency = rawTiming.Latencies()
fmt.Println("Raw FS (ms):", latency)
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment