profilerecord.mx raw

   1  // Copyright 2024 The Go Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  // Package profilerecord holds internal types used to represent profiling
   6  // records with deep stack traces.
   7  //
   8  // TODO: Consider moving this to internal/runtime, see golang.org/issue/65355.
   9  package profilerecord
  10  
  11  type StackRecord struct {
  12  	Stack []uintptr
  13  }
  14  
  15  type MemProfileRecord struct {
  16  	AllocBytes, FreeBytes     int64
  17  	AllocObjects, FreeObjects int64
  18  	Stack                     []uintptr
  19  }
  20  
  21  func (r *MemProfileRecord) InUseBytes() int64   { return r.AllocBytes - r.FreeBytes }
  22  func (r *MemProfileRecord) InUseObjects() int64 { return r.AllocObjects - r.FreeObjects }
  23  
  24  type BlockProfileRecord struct {
  25  	Count  int64
  26  	Cycles int64
  27  	Stack  []uintptr
  28  }
  29