Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for heapUpdate (0.1 sec)

  1. src/internal/trace/batchcursor_test.go

    		if heap[i].ev.time == 5 {
    			heap[i].ev.time = -21
    			heapUpdate(heap, i)
    			break
    		}
    	}
    	checkHeap(t, heap)
    	if heap[0].ev.time != -21 {
    		t.Fatalf("heap update failed, expected %d as heap min: %s", -21, heapDebugString(heap))
    	}
    
    	// Update the minimum element to be smaller. There should be no change.
    	heap[0].ev.time = -22
    	heapUpdate(heap, 0)
    	checkHeap(t, heap)
    	if heap[0].ev.time != -22 {
    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

    	// 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
    }
    
    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)
    }
    
    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

    		// Refresh the cursor's event.
    		ok, err := bc.nextEvent(r.gen.batches[bc.m], r.gen.freq)
    		if err != nil {
    			return false, err
    		}
    		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
    	}
    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