github.com/cockroachdb/pebble@v1.1.2/internal/cache/clockpro_tracing.go (about)

     1  // Copyright 2022 The LevelDB-Go and Pebble Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  //go:build tracing
     6  // +build tracing
     7  
     8  package cache
     9  
    10  import (
    11  	"fmt"
    12  	"runtime/debug"
    13  )
    14  
    15  func (c *Cache) trace(msg string, refs int64) {
    16  	s := fmt.Sprintf("%s: refs=%d\n%s", msg, refs, debug.Stack())
    17  	c.tr.Lock()
    18  	c.tr.msgs = append(c.tr.msgs, s)
    19  	c.tr.Unlock()
    20  }