From f633909141dc1e2c2e49b94e5e478e99be51a9cb Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Sun, 13 Aug 2017 15:42:51 +1000 Subject: Markdown output from DumpDebugStats --- debugon.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'debugon.go') diff --git a/debugon.go b/debugon.go index f194bbc..b976839 100644 --- a/debugon.go +++ b/debugon.go @@ -139,12 +139,13 @@ func DisableLogging() { // DumpDebugStats will print out the curring timings for each parser if built with -tags debug func DumpDebugStats() { sort.Slice(parsers, func(i, j int) bool { - return parsers[i].Self >= parsers[j].Self + return parsers[i].Cumulative >= parsers[j].Cumulative }) - fmt.Println("Parser stats:") - fmt.Println(" var name matches total time self time calls errors location ") + fmt.Println() + fmt.Println("| var name | matches | total time | self time | calls | errors | location ") + fmt.Println("| -------------------- | -------------------- | --------------- | --------------- | ---------- | ---------- | ----------") for _, parser := range parsers { - fmt.Printf("%20s %20s %15s %15s %10d calls %10d errors %s\n", parser.Var, parser.Match, parser.Cumulative.String(), parser.Self.String(), parser.Calls, parser.Errors, parser.Location) + fmt.Printf("| %20s | %20s | %15s | %15s | %10d | %10d | %s\n", parser.Var, parser.Match, parser.Cumulative.String(), parser.Self.String(), parser.Calls, parser.Errors, parser.Location) } } -- cgit v1.2.3