<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 常見分析指標 * Wall Time * CPU Time * Block Time * Memory Allocation * Gc Times/time spent ## 性能分析工具 ``` sudo apt-get install graphviz ``` ### go-torch 火炬圖 ### 通過文件方式輸出Profile go tool pprof 1.11以上版本默認有 * `go tool pprof [binary] [binary.prof]` * 查看報告:go tool pprof prof cpu.prof 示例: ``` package main import ( "log" "math/rand" "os" "runtime" "runtime/pprof" "time" ) const ( col = 10000 row = 10000 ) func fillMatrix(m *[row][col]int) { s := rand.New(rand.NewSource(time.Now().UnixNano())) for i := 0; i < row; i++ { for j := 0; j < col; j++ { m[i][j] = s.Intn(100000) } } } func calculate(m *[row][col]int) { for i := 0; i < row; i++ { tmp := 0 for j := 0; j < col; j++ { tmp += m[i][j] } } } func main() { //創建輸出文件 f, err := os.Create("cpu.prof") if err != nil { log.Fatal("could not create CPU profile: ", err) } // 獲取系統信息 if err := pprof.StartCPUProfile(f); err != nil { //監控cpu log.Fatal("could not start CPU profile: ", err) } defer pprof.StopCPUProfile() // 主邏輯區,進行一些簡單的代碼運算 x := [row][col]int{} fillMatrix(&x) calculate(&x) f1, err := os.Create("mem.prof") if err != nil { log.Fatal("could not create memory profile: ", err) } runtime.GC() // GC,獲取最新的數據信息 if err := pprof.WriteHeapProfile(f1); err != nil { // 寫入內存信息 log.Fatal("could not write memory profile: ", err) } f1.Close() f2, err := os.Create("goroutine.prof") if err != nil { log.Fatal("could not create groutine profile: ", err) } if gProf := pprof.Lookup("goroutine"); gProf == nil { log.Fatal("could not write groutine profile: ") } else { gProf.WriteTo(f2, 0) } f2.Close() } ```
                  <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>

                              哎呀哎呀视频在线观看