FAQ
FWIW, I add an attachment of the resulted patch here.
On Wednesday, March 16, 2016 at 1:54:09 PM UTC+8, mura wrote:

Hi,

I have implemented two new flags (-cumsize and -pkgsize) for /cmd/nm

The output looks like:


$ go tool nm *-*size -sort size ./foo

5c32e0 637567 r runtime.pclntab
681b20 65688 D runtime.trace
500d90 17520 T unicode.init
67dc60 16064 D runtime.semtable
4c55f0 13984 T time.parse
46af40 12992 T fmt.(*pp).printReflectValue
67ab20 12584 D runtime.mheap_
48e4e0 10144 T crypto/sha256.block
4c28b0 9440 T time.Time.AppendFormat
6955e0 8192 D runtime.pdesc
678b80 8072 D runtime.hash
(More entries below are omitted)

$ go tool nm* -*size *-cumsize* -sort size ./foo

5c32e0 637567 637567 r runtime.pclntab
681b20 65688 703255 D runtime.trace
500d90 17520 720775 T unicode.init
67dc60 16064 736839 D runtime.semtable
4c55f0 13984 750823 T time.parse
46af40 12992 763815 T fmt.(*pp).printReflectValue
67ab20 12584 776399 D runtime.mheap_
48e4e0 10144 786543 T crypto/sha256.block
4c28b0 9440 795983 T time.Time.AppendFormat
6955e0 8192 804175 D runtime.pdesc
678b80 8072 812247 D runtime.hash
(More entries below are omitted)

`$ go tool nm -pkgsize ./foo` will add a table at the bottom:

Contributions of size per package:

runtime 1057005
sync/atomic 504
x_cgo_mmap 45
x_cgo_threadentry 8
bufio 8049
hash 65
runtime/debug 832
runtime/cgo 1446
internal/singleflight 65
io 1793
sync 5649
x_cgo_inittls 8
fatalf 206


I wrote this for figuring out why my programs are so huge, and hopefully
being able to replace some heavy weight dependencies with simplified ones.
(Those programs need to be transmitted over serial ports and probably
telephone lines so size matters.)
The modification is pretty straightforward. If it is useful for others and
compatible with the purpose of /cmd/nm, I will submit it for review.
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 9 | next ›
Discussion Overview
groupgolang-dev @
categoriesgo
postedMar 16, '16 at 5:54a
activeMar 17, '16 at 3:44a
posts9
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase