<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                這一點主要使用pprof來實現。開啟pprof也特別簡單,用net/http/pprof包可以快速實現。只需要在之前的代碼中加下面三行就可以: ~~~ package main import ( "log" "net/http" _ "net/http/pprof" ) func main() { log.Println(http.ListenAndServe("localhost:8081", nil)) } ~~~ 在程序啟動之后,只需要在命令行或者瀏覽器輸入以下命令即可: ~~~ go tool pprof http://127.0.0.1:8081/debug/pprof/heap //查看堆的使用,即內存使用情況 go tool pprof http://127.0.0.1:8081/debug/pprof/profile //查看cpu耗時,會詳細列出每個函數的耗時 go tool pprof http://127.0.0.1:8081/debug/pprof/goroutine //當前在運行的goroutine情況以及總數 ~~~ 可以看下profile的輸出信息, flat代表單個函數的運行時間,而cum則是累加的時間,也會包括這個函數下面的子函數的累加時間,所以main.main肯定是100%: ~~~ Showing nodes accounting for 1485.59kB, 100% of 1485.59kB total Showing top 10 nodes out of 14 flat flat% sum% cum cum% 902.59kB 60.76% 60.76% 1485.59kB 100% compress/flate.NewWriter /usr/local/go/src/compress/flate/deflate.go 583.01kB 39.24% 100% 583.01kB 39.24% compress/flate.newDeflateFast /usr/local/go/src/compress/flate/deflatefast.go (inline) 0 0% 100% 583.01kB 39.24% compress/flate.(*compressor).init /usr/local/go/src/compress/flate/deflate.go 0 0% 100% 1485.59kB 100% compress/gzip.(*Writer).Write /usr/local/go/src/compress/gzip/gzip.go 0 0% 100% 1485.59kB 100% net/http.(*ServeMux).ServeHTTP /usr/local/go/src/net/http/server.go 0 0% 100% 1485.59kB 100% net/http.(*conn).serve /usr/local/go/src/net/http/server.go 0 0% 100% 1485.59kB 100% net/http.HandlerFunc.ServeHTTP /usr/local/go/src/net/http/server.go 0 0% 100% 1485.59kB 100% net/http.serverHandler.ServeHTTP /usr/local/go/src/net/http/server.go 0 0% 100% 1485.59kB 100% net/http/pprof.Index /usr/local/go/src/net/http/pprof/pprof.go 0 0% 100% 1485.59kB 100% net/http/pprof.handler.ServeHTTP /usr/local/go/src/net/http/pprof/pprof.go ~~~ 如果想看具體的圖示的話,可以使用png命令將結果存成圖片看(png > "路徑"),比如: ~~~ (pprof) png > /Users/liupengjie/Downloads/heap.png Generating report in /Users/liupengjie/Downloads/heap.png ~~~ 可以看到生成圖片的樣子, 有具體的箭頭以及每個函數占用的時間或者內存。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看