久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網
      最全最豐富的資訊網站

      關于golang cpu性能分析

      下面由golang教程欄目給大家介紹golang cpu性能分析,希望對需要的朋友有所幫助!

      關于golang cpu性能分析

      一、分析程序的運行時間

      (1)time指令(linux系統(tǒng)下)

      time go run a.go

      real:從程序開始到結束,實際上度過的時間

      user:程序在用戶態(tài)度過的時間

      sys:程序在內核度過的時間

      一般情況下,real>=user+sys

      (2) /usr/bin/time 指令(linux系統(tǒng)下)

      /usr/bin/time -v go run a.go

      該指令下 可以看到 cpu占用率、 內存使用情況、 進程切換情況 、文件系統(tǒng)io、socket情況

      二.golang下cpu性能分析

      (1)在程序中引入 _ "net/http/pprof" ,并開啟pprof監(jiān)聽

       import _
      http.ListenAndServe("0.0.0.0:10000", nil)
      程序結束

      通過瀏覽器查看 CPU的信息和狀態(tài)

      http://127.0.0.1:10000/debug/pprof

      注意,等程序運??定時間,再點擊profile?件?成(?少是30s)

      (2)使用pprof

      go tool pprof [binary] [profile] //binary二進制文件 profile 要分析的文件
      top //查看當前profile文件的cpu使用率

      flat 該函數?身代碼的執(zhí)?時?

      flat% 該函數?身代碼的執(zhí)?時?占?CPU的耗時百分?

      cum 代表的是該函數?身代碼+所有調?的函數的執(zhí)?時?

      cum% 代表的是該函數?身代碼+所有調?的函數的執(zhí)?時?,占?CPU的總耗時百分?

      sum% 每??的flat%與上?所有?的flat%總和

      (3)go tool pprof profile文件

      啟動要調試的程序,在另一個終端執(zhí)行 go tool pprof http://localhost:10000/debug/pprof/profile?seconds=60

      (4)可視化結構圖

      先在終端運行 go tool pprof [binary] [profile] ,然后輸入web,瀏覽器會彈出一個可視化的圖片。

      贊(0)
      分享到: 更多 (0)
      網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號