Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for heapRemove (0.09 sec)

  1. src/internal/trace/batchcursor_test.go

    	for i := range heap {
    		if heap[i].ev.time == 5 {
    			heap = heapRemove(heap, i)
    			break
    		}
    	}
    	checkHeap(t, heap)
    	for i := range heap {
    		if heap[i].ev.time == 5 {
    			t.Fatalf("failed to remove heap elem with time %d: %s", 5, heapDebugString(heap))
    		}
    	}
    
    	// Remove tail.
    	heap = heapRemove(heap, len(heap)-1)
    	checkHeap(t, heap)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 3K bytes
    - Viewed (0)
  2. src/internal/trace/batchcursor.go

    }
    
    func heapUpdate(heap []*batchCursor, i int) {
    	// Try to sift up.
    	if heapSiftUp(heap, i) != i {
    		return
    	}
    	// Try to sift down, if sifting up failed.
    	heapSiftDown(heap, i)
    }
    
    func heapRemove(heap []*batchCursor, i int) []*batchCursor {
    	// Sift index i up to the root, ignoring actual values.
    	for i > 0 {
    		heap[(i-1)/2], heap[i] = heap[i], heap[(i-1)/2]
    		i = (i - 1) / 2
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  3. src/internal/trace/reader.go

    		}
    		if ok {
    			// If we successfully refreshed, update the heap.
    			heapUpdate(r.frontier, i)
    		} else {
    			// There's nothing else to read. Delete this cursor from the frontier.
    			r.frontier = heapRemove(r.frontier, i)
    		}
    		return true, nil
    	}
    	// Inject a CPU sample if it comes next.
    	if len(r.cpuSamples) != 0 {
    		if len(r.frontier) == 0 || r.cpuSamples[0].time < r.frontier[0].ev.time {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 6.7K bytes
    - Viewed (0)
Back to top