diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-04-03 19:13:12 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-04-03 19:13:12 +0000 |
commit | eb2d1a782c0bd66413fc45e66848baf774511c83 (patch) | |
tree | dfbfb61cd2e3a1fa7cfba0074395c0ebb291d4ad /llgo | |
parent | 4e4e8662bca5ccd92c098b0a791bac1927affe8a (diff) | |
download | bcm5719-llvm-eb2d1a782c0bd66413fc45e66848baf774511c83.tar.gz bcm5719-llvm-eb2d1a782c0bd66413fc45e66848baf774511c83.zip |
benchcomp: Add a mode for analyzing file sizes.
llvm-svn: 299376
Diffstat (limited to 'llgo')
-rw-r--r-- | llgo/utils/benchcomp/main.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llgo/utils/benchcomp/main.go b/llgo/utils/benchcomp/main.go index a050f7bdd5f..69eb6d1a914 100644 --- a/llgo/utils/benchcomp/main.go +++ b/llgo/utils/benchcomp/main.go @@ -6,6 +6,7 @@ import ( "debug/macho" "fmt" "os" + "path/filepath" "sort" "strconv" "strings" @@ -138,6 +139,22 @@ func ninja_logs(path string) map[string]float64 { return m } +func filesizes(root string) map[string]float64 { + m := make(map[string]float64) + + err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if info.Mode().IsRegular() { + m[path[len(root):]] = float64(info.Size()) + } + return nil + }) + if err != nil { + panic(err.Error()) + } + + return m +} + func main() { var cmp func(string) map[string]float64 switch os.Args[1] { @@ -159,6 +176,9 @@ func main() { case "ninja_logs": cmp = ninja_logs + + case "filesizes": + cmp = filesizes } syms1 := cmp(os.Args[2]) |