Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 73 for MemStats (0.13 sec)

  1. test/gc2.go

    func main() {
    	const N = 10000
    	st := new(runtime.MemStats)
    	memstats := new(runtime.MemStats)
    	runtime.ReadMemStats(st)
    	for i := 0; i < N; i++ {
    		c := make(chan int, 10)
    		_ = c
    		if i%100 == 0 {
    			for j := 0; j < 4; j++ {
    				runtime.GC()
    				runtime.Gosched()
    				runtime.GC()
    				runtime.Gosched()
    			}
    		}
    	}
    
    	runtime.ReadMemStats(memstats)
    	obj := int64(memstats.HeapObjects - st.HeapObjects)
    	if obj > N/5 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:25 UTC 2023
    - 977 bytes
    - Viewed (0)
  2. src/runtime/mstats.go

    		// should be identical to some combination of memstats. In particular:
    		//
    		// * memstats.heapInUse == inHeap
    		// * memstats.heapReleased == released
    		// * memstats.heapInUse + memstats.heapFree == committed - inStacks - inWorkBufs - inPtrScalarBits
    		// * memstats.totalAlloc == totalAlloc
    		// * memstats.totalFree == totalFree
    		//
    		// Check if that's actually true.
    		//
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 08 21:03:13 UTC 2024
    - 34.2K bytes
    - Viewed (0)
  3. src/testing/allocs.go

    	// Warm up the function
    	f()
    
    	// Measure the starting statistics
    	var memstats runtime.MemStats
    	runtime.ReadMemStats(&memstats)
    	mallocs := 0 - memstats.Mallocs
    
    	// Run the function the specified number of times
    	for i := 0; i < runs; i++ {
    		f()
    	}
    
    	// Read the final statistics
    	runtime.ReadMemStats(&memstats)
    	mallocs += memstats.Mallocs
    
    	// Average the mallocs over the runs (not counting the warm-up).
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 02 00:13:47 UTC 2016
    - 1.4K bytes
    - Viewed (0)
  4. cmd/admin-server-info.go

    		Uptime:   UTCNow().Unix() - globalBootTime.Unix(),
    		Version:  Version,
    		CommitID: CommitID,
    		Network:  network,
    		MemStats: madmin.MemStats{
    			Alloc:      memstats.Alloc,
    			TotalAlloc: memstats.TotalAlloc,
    			Mallocs:    memstats.Mallocs,
    			Frees:      memstats.Frees,
    			HeapAlloc:  memstats.HeapAlloc,
    		},
    		GoMaxProcs:     runtime.GOMAXPROCS(0),
    		NumCPU:         runtime.NumCPU(),
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri May 24 23:05:23 UTC 2024
    - 4.9K bytes
    - Viewed (0)
  5. test/closure.go

    	go h()
    	check([]int{100, 200, 101, 201, 500, 101, 201, 500})
    
    	memstats := new(runtime.MemStats)
    	runtime.ReadMemStats(memstats)
    	n0 := memstats.Mallocs
    
    	x, y := newfunc(), newfunc()
    	if x(1) != 1 || y(2) != 2 {
    		println("newfunc returned broken funcs")
    		fail = true
    	}
    
    	runtime.ReadMemStats(memstats)
    	if n0 != memstats.Mallocs {
    		println("newfunc allocated unexpectedly")
    		fail = true
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Jul 01 17:59:50 UTC 2012
    - 1.7K bytes
    - Viewed (0)
  6. test/chan/select2.go

    	receiver(c, dummy, 100000)
    	runtime.GC()
    	memstats := new(runtime.MemStats)
    	runtime.ReadMemStats(memstats)
    	alloc := memstats.Alloc
    
    	// second time shouldn't increase footprint by much
    	go sender(c, 100000)
    	receiver(c, dummy, 100000)
    	runtime.GC()
    	runtime.ReadMemStats(memstats)
    
    	// Be careful to avoid wraparound.
    	if memstats.Alloc > alloc && memstats.Alloc-alloc > 1.1e5 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 1K bytes
    - Viewed (0)
  7. src/testing/benchmark.go

    // before a benchmark starts, but it can also be used to resume timing after
    // a call to [B.StopTimer].
    func (b *B) StartTimer() {
    	if !b.timerOn {
    		runtime.ReadMemStats(&memStats)
    		b.startAllocs = memStats.Mallocs
    		b.startBytes = memStats.TotalAlloc
    		b.start = highPrecisionTimeNow()
    		b.timerOn = true
    	}
    }
    
    // StopTimer stops timing a test. This can be used to pause the timer
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 23.9K bytes
    - Viewed (0)
  8. test/init1.go

    	go send(c)
    	<-c
    
    	const N = 1000
    	const MB = 1 << 20
    	b := make([]byte, MB)
    	for i := range b {
    		b[i] = byte(i%10 + '0')
    	}
    	s := string(b)
    
    	memstats := new(runtime.MemStats)
    	runtime.ReadMemStats(memstats)
    	sys, numGC := memstats.Sys, memstats.NumGC
    
    	// Generate 1,000 MB of garbage, only retaining 1 MB total.
    	for i := 0; i < N; i++ {
    		x = []byte(s)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 1.1K bytes
    - Viewed (0)
  9. src/runtime/testdata/testprog/gc.go

    func GCSys() {
    	runtime.GOMAXPROCS(1)
    	memstats := new(runtime.MemStats)
    	runtime.GC()
    	runtime.ReadMemStats(memstats)
    	sys := memstats.Sys
    
    	runtime.MemProfileRate = 0 // disable profiler
    
    	itercount := 100000
    	for i := 0; i < itercount; i++ {
    		workthegc()
    	}
    
    	// Should only be using a few MB.
    	// We allocated 100 MB or (if not short) 1 GB.
    	runtime.ReadMemStats(memstats)
    	if sys > memstats.Sys {
    		sys = 0
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Oct 02 02:28:27 UTC 2022
    - 12.1K bytes
    - Viewed (0)
  10. pkg/ctrlz/topics/mem.go

    		ms := &runtime.MemStats{}
    		runtime.ReadMemStats(ms)
    		fw.RenderHTML(w, tmpl, ms)
    	})
    
    	_ = context.JSONRouter().StrictSlash(true).NewRoute().Methods("GET").Path("/").HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
    		ms := &runtime.MemStats{}
    		runtime.ReadMemStats(ms)
    		fw.RenderJSON(w, http.StatusOK, ms)
    	})
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 24 14:06:41 UTC 2023
    - 1.8K bytes
    - Viewed (0)
Back to top