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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## 語法 ``` func KeepAlive(x interface{}) func LockOSThread() // 協程轉為線程 func UnlockOSThread() func NumCPU() int func NumCgoCall() int64 // 返回當前進程執行的cgo調用次數 func NumGoroutine() int // 返回當前存在的Go程數 func Version() string func GC() // GC執行一次垃圾回收 func GOMAXPROCS(n int) int // 同時執行的最大CPU數 func GOROOT() func ReadMemStats(m *MemStats) func SetBlockProfileRate(rate int) // 阻塞profile記錄go程阻塞事件的采樣頻率 func SetCPUProfileRate(hz int) // CPU profile記錄的速率為平均每秒hz次 func SetMutexProfileFraction(rate int) int // 互斥配置文件中報告的互斥爭用事件的比例 func StartTrace() error func StopTrace() ``` ## runtime.MemStats ``` type MemStats struct { // 一般統計 Alloc uint64 // 已申請且仍在使用的字節數 TotalAlloc uint64 // 已申請的總字節數(已釋放的部分也算在內) Sys uint64 // 從系統中獲取的字節數(下面XxxSys之和) Lookups uint64 // 指針查找的次數 Mallocs uint64 // 申請內存的次數 Frees uint64 // 釋放內存的次數 // 主分配堆統計 HeapAlloc uint64 // 已申請且仍在使用的字節數 HeapSys uint64 // 從系統中獲取的字節數 HeapIdle uint64 // 閑置span中的字節數 HeapInuse uint64 // 非閑置span中的字節數 HeapReleased uint64 // 釋放到系統的字節數 HeapObjects uint64 // 已分配對象的總個數 // L低層次、大小固定的結構體分配器統計,Inuse為正在使用的字節數,Sys為從系統獲取的字節數 StackInuse uint64 // 引導程序的堆棧 StackSys uint64 MSpanInuse uint64 // mspan結構體 MSpanSys uint64 MCacheInuse uint64 // mcache結構體 MCacheSys uint64 BuckHashSys uint64 // profile桶散列表 GCSys uint64 // GC元數據 OtherSys uint64 // 其他系統申請 // 垃圾收集器統計 NextGC uint64 // 會在HeapAlloc字段到達該值(字節數)時運行下次GC LastGC uint64 // 上次運行的絕對時間(納秒) PauseTotalNs uint64 PauseNs [256]uint64 // 近期GC暫停時間的循環緩沖,最近一次在[(NumGC+255)%256] NumGC uint32 EnableGC bool DebugGC bool // 每次申請的字節數的統計,61是C代碼中的尺寸分級數 BySize [61]struct { Size uint32 Mallocs uint64 Frees uint64 } } ``` ## 實例 ### ReadMemStats 獲取 MemStats ``` var mem runtime.MemStats runtime.ReadMemStats(&mem) fmt.Printf("%+v\n", mem) ``` ### stack 異常打印堆棧信息 ``` defer func() { if r := recover(); r != nil { err := r.(error) log.Errorf("recover:%+v\tstackinfo:%v\n\n", err, utils.GetStackInfo()) } }() // 與 debug.Stack 相似 func GetStackInfo() string { buf := make([]byte, 4096) n := runtime.Stack(buf, false) return fmt.Sprintf("%s", buf[:n]) } ```
                  <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>

                              哎呀哎呀视频在线观看