Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
e09f1e7a
Commit
e09f1e7a
authored
Dec 22, 2012
by
Shenghou Ma
Committed by
Russ Cox
Dec 22, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc/benchcmp: show byte allocation statistics
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/6971048
parent
4b7c2dfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
misc/benchcmp
misc/benchcmp
+30
-4
No files found.
misc/benchcmp
View file @
e09f1e7a
...
@@ -35,18 +35,28 @@ $1 ~ /Benchmark/ && $4 == "ns/op" {
...
@@ -35,18 +35,28 @@ $1 ~ /Benchmark/ && $4 == "ns/op" {
# allocs/op might be at $8 or $10 depending on if
# allocs/op might be at $8 or $10 depending on if
# SetBytes was used or not.
# SetBytes was used or not.
if($8 == "allocs/op")
# B/op might be at $6 or $8, it should be immediately
# followed by allocs/op
if($8 == "allocs/op") {
newbytes[$1] = $5
newalloc[$1] = $7
newalloc[$1] = $7
if($10 == "allocs/op")
}
if($10 == "allocs/op") {
newbytes[$1] = $7
newalloc[$1] = $9
newalloc[$1] = $9
}
} else {
} else {
old[$1] = $3
old[$1] = $3
if($6 == "MB/s")
if($6 == "MB/s")
oldmb[$1] = $5
oldmb[$1] = $5
if($8 == "allocs/op")
if($8 == "allocs/op") {
oldbytes[$1] = $5
oldalloc[$1] = $7
oldalloc[$1] = $7
if($10 == "allocs/op")
}
if($10 == "allocs/op") {
oldbytes[$1] = $7
oldalloc[$1] = $9
oldalloc[$1] = $9
}
}
}
}
}
...
@@ -94,5 +104,21 @@ END {
...
@@ -94,5 +104,21 @@ END {
printf("%-*s %12d %12d %6s%%\n", len, what,
printf("%-*s %12d %12d %6s%%\n", len, what,
oldalloc[what], newalloc[what], delta)
oldalloc[what], newalloc[what], delta)
}
}
# print alloc bytes
anybytes = 0
for(i=0; i<n; i++) {
what = name[i]
if(!(what in newbytes))
continue
if(anybytes++ == 0)
printf("\n%-*s %12s %12s %7s\n", len, "benchmark", "old bytes", "new bytes", "delta")
if(oldbytes[what] == 0)
delta="n/a"
else
delta=sprintf("%.2f", 100*newbytes[what]/oldbytes[what]-100)
printf("%-*s %12d %12d %6s%%\n", len, what,
oldbytes[what], newbytes[what], delta)
}
}
}
'
"
$@
"
'
"
$@
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment