Stats prints the engine stats, cumulative and from the current run.
()
| 22 | |
| 23 | // Stats prints the engine stats, cumulative and from the current run. |
| 24 | func (e *Engine) Stats() string { |
| 25 | b := &strings.Builder{} |
| 26 | |
| 27 | fmt.Fprintln(b, "==================================") |
| 28 | fmt.Fprintln(b, "Build Info") |
| 29 | fmt.Fprintln(b, "==================================") |
| 30 | fmt.Fprintf(b, " Repo build time: %25v\n", repoBuildTime) |
| 31 | fmt.Fprintf(b, " Repo git revision: %25v\n", repoGitRevision) |
| 32 | fmt.Fprintf(b, " Repo git branch: %25v\n", repoGitBranch) |
| 33 | fmt.Fprintln(b, "") |
| 34 | fmt.Fprintf(b, " Engine build time: %25v\n", testBuildTime) |
| 35 | fmt.Fprintf(b, " Engine git revision: %25v\n", testGitRevision) |
| 36 | fmt.Fprintf(b, " Engine git branch: %25v\n", testGitBranch) |
| 37 | fmt.Fprintln(b, "") |
| 38 | fmt.Fprintln(b, "==================================") |
| 39 | fmt.Fprintln(b, "Engine Action Summary (Cumulative)") |
| 40 | fmt.Fprintln(b, "==================================") |
| 41 | fmt.Fprintf(b, " Engine runtime: %10vs\n", e.getRuntimeSeconds()) |
| 42 | fmt.Fprintln(b, "") |
| 43 | fmt.Fprint(b, e.CumulativeStats.Stats()) |
| 44 | fmt.Fprintln(b, "") |
| 45 | |
| 46 | fmt.Fprintln(b, "==================================") |
| 47 | fmt.Fprintln(b, "Engine Action Summary (This Run)") |
| 48 | fmt.Fprintln(b, "==================================") |
| 49 | fmt.Fprint(b, e.RunStats.Stats()) |
| 50 | fmt.Fprintln(b, "") |
| 51 | |
| 52 | return b.String() |
| 53 | } |
| 54 | |
| 55 | // Stats tracks statistics during engine runtime. |
| 56 | type Stats struct { |