Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for IgnorePC (0.14 sec)

  1. src/log/slog/internal/ignorepc.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package internal
    
    // If IgnorePC is true, do not invoke runtime.Callers to get the pc.
    // This is solely for benchmarking the slowdown from runtime.Callers.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 21 20:55:33 UTC 2023
    - 338 bytes
    - Viewed (0)
  2. src/log/slog/logger.go

    	capturePC bool
    }
    
    func (w *handlerWriter) Write(buf []byte) (int, error) {
    	level := w.level.Level()
    	if !w.h.Enabled(context.Background(), level) {
    		return 0, nil
    	}
    	var pc uintptr
    	if !internal.IgnorePC && w.capturePC {
    		// skip [runtime.Callers, w.Write, Logger.Output, log.Print]
    		var pcs [1]uintptr
    		runtime.Callers(4, pcs[:])
    		pc = pcs[0]
    	}
    
    	// Remove final newline.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 18:26:18 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  3. src/log/slog/internal/benchmarks/benchmarks_test.go

    package benchmarks
    
    import (
    	"context"
    	"flag"
    	"internal/race"
    	"io"
    	"log/slog"
    	"log/slog/internal"
    	"testing"
    )
    
    func init() {
    	flag.BoolVar(&internal.IgnorePC, "nopc", false, "do not invoke runtime.Callers")
    }
    
    // We pass Attrs inline because it affects allocations: building
    // up a list outside of the benchmarked code and passing it in with "..."
    // reduces measured allocations.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 4.5K bytes
    - Viewed (0)
Back to top