New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: add --benchmem flag to benchmark command #2432

Closed
bogem opened this Issue Sep 11, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@bogem
Contributor

bogem commented Sep 11, 2016

I want to see, how many memory hugo consumes in the same way as go test -bench=. --benchmem do.

@bep bep closed this Sep 11, 2016

@bogem

This comment has been minimized.

Show comment
Hide comment
@bogem

bogem Sep 11, 2016

Contributor

But it's not the question, it's feature request: it would be great to add --benchmem flag to benchmark command🙏

Contributor

bogem commented Sep 11, 2016

But it's not the question, it's feature request: it would be great to add --benchmem flag to benchmark command🙏

@bep bep reopened this Sep 11, 2016

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Sep 11, 2016

Member

Yes, we should maybe refit that command to a Go benchmark ...

Also see https://github.com/bep/hugo-benchmark

Member

bep commented Sep 11, 2016

Yes, we should maybe refit that command to a Go benchmark ...

Also see https://github.com/bep/hugo-benchmark

@bogem

This comment has been minimized.

Show comment
Hide comment
@bogem

bogem Sep 11, 2016

Contributor

I think, it could be implemented like that:

var mem runtime.MemStats
runtime.ReadMemStats(&mem)
before := mem.Alloc
// operations...
runtime.ReadMemStats(&mem)
after := mem.Alloc

memUsage := after - before
// print memUsage
Contributor

bogem commented Sep 11, 2016

I think, it could be implemented like that:

var mem runtime.MemStats
runtime.ReadMemStats(&mem)
before := mem.Alloc
// operations...
runtime.ReadMemStats(&mem)
after := mem.Alloc

memUsage := after - before
// print memUsage

bogem added a commit to bogem/hugo that referenced this issue Nov 17, 2016

commands: Make benchmark command more useful
* Add information about average time, memory consumption and
allocations.
* Fix situation, when user provides memprofile and cpuprofile, but
cpuprofile will not created.

Fixes #2432

@bep bep closed this in #2698 Nov 18, 2016

bep added a commit that referenced this issue Nov 18, 2016

commands: Make benchmark command more useful
* Add information about average time, memory consumption and
allocations.
* Fix situation, when user provides memprofile and cpuprofile, but
cpuprofile will not created.

Fixes #2432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment