Search Options

Results per page
Sort
Preferred Languages
Advance

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

  1. src/internal/trace/batchcursor_test.go

    	"slices"
    )
    
    func TestHeap(t *testing.T) {
    	var heap []*batchCursor
    
    	// Insert a bunch of values into the heap.
    	checkHeap(t, heap)
    	heap = heapInsert(heap, makeBatchCursor(5))
    	checkHeap(t, heap)
    	for i := int64(-20); i < 20; i++ {
    		heap = heapInsert(heap, makeBatchCursor(i))
    		checkHeap(t, heap)
    	}
    
    	// Update an element in the middle to be the new minimum.
    	for i := range heap {
    		if heap[i].ev.time == 5 {
    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

    		arg, nb := binary.Uvarint(b[n:])
    		if nb <= 0 {
    			return 0, 0, fmt.Errorf("found invalid uvarint")
    		}
    		e.args[i] = arg
    		n += nb
    	}
    	return n, timestamp(ts), nil
    }
    
    func heapInsert(heap []*batchCursor, bc *batchCursor) []*batchCursor {
    	// Add the cursor to the end of the heap.
    	heap = append(heap, bc)
    
    	// Sift the new entry up to the right place.
    	heapSiftUp(heap, len(heap)-1)
    	return heap
    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 err != nil {
    				return Event{}, err
    			}
    			if !ok {
    				// Turns out there aren't actually any events in these batches.
    				continue
    			}
    			r.frontier = heapInsert(r.frontier, bc)
    		}
    
    		// Reset emittedSync.
    		r.emittedSync = false
    	}
    	tryAdvance := func(i int) (bool, error) {
    		bc := r.frontier[i]
    
    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