仙人掌世界

learn - innovate - share

Apr 21, 2013

golang - Flag 隱藏選項 -help 與 -h

›
預設的 FlagSet 裡藏了兩個預設選項 -help 跟 -h, 在用 flag 時可以少寫一點 boilerplate code src/pkg/flag/flag.go func (f *FlagSet) parseOne() (bool, error) { ...
Apr 19, 2013

golang - Profiling Go Programs 記錄(Part 5)

›
結論 這裡用的 Profiling 方法跟在 Java 沒什麼太大差別,仍是使用工具找出程式與資源間的關系, 會需要看點 Go 函式庫源始碼, 還好 Go net/http 函式庫的程式碼大部份都不會很長還滿好懂,過程也沒遇到什麼奇怪的狀況。 內建的 Profiling 工...
Apr 18, 2013

golang - Profiling Go Programs 記錄(Part 4)

›
4. 快取計算結果 第2與3項只修正 bug 但對效能沒有直接改善,以目前的觀測結果,程式向系統申請的記憶體用量還有點高(350M左右), 接著來檢查 GC 與 heap 狀況看哪些物件申請了這些記憶體 用 GOGCTRACE=1 讓 GO runtime 把 gclog 印...

golang - Profiling Go Programs 記錄(Part 3)

›
3. 正常結束 Goroutine $ go tool pprof ./gb heap-6438-1.pprof (pprof) top10 Total: 8.6 MB 1.5 17.8% 17.8% 3.0 35.3% main.(*Benchma...

golang - Profiling Go Programs 記錄(Part 2)

›
2. 程式化停止 Timer $ go tool pprof ./gb cpu-27989.pprof Welcome to pprof! For help, type 'help'. (pprof) top10 Total: 967 samples ...
‹
›
Home
View web version
Powered by Blogger.