Package ghidra.trace.model.time.schedule

# Interface Scheduler

public interface Scheduler
A generator of an emulator's thread schedule

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static final record`
  `Scheduler.RecordRunResult`
  The result of running a machine
  `static interface`
  `Scheduler.RunResult`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TickStep`
  `nextSlice(Trace trace)`
  Get the next step to schedule
  `static Scheduler`
  `oneThread(TraceThread thread)`
  Create a scheduler that allocates all slices to a single thread
  `default Scheduler.RunResult`
  `run(Trace trace, TraceThread eventThread, PcodeMachine<?> machine, TaskMonitor monitor)`
  Run a machine according to the given schedule until it is interrupted

- ## Method Details

  - ### oneThread

    static Scheduler oneThread(TraceThread thread)
    Create a scheduler that allocates all slices to a single thread
    Parameters:
      `thread` - the thread to schedule
    Returns:
      the scheduler

  - ### nextSlice

    TickStep nextSlice(Trace trace)
    Get the next step to schedule
    Parameters:
      `trace` - the trace being emulated
    Returns:
      the thread and (instruction-level) tick count

  - ### run

    default Scheduler.RunResult run(Trace trace, TraceThread eventThread, PcodeMachine<?> machine, TaskMonitor monitor)
    Run a machine according to the given schedule until it is interrupted

    This method will drop p-code steps from injections, including those from execution breakpoints. The goal is to ensure that the returned schedule can be used to recover the same state on a machine without injections. Unfortunately, injections which modify the machine state, other than unique variables, will defeat that goal.

    Parameters:
      `trace` - the trace whose threads to schedule
      `eventThread` - the first thread to schedule if the scheduler doesn't specify
      `machine` - the machine to run
      `monitor` - a monitor for cancellation
    Returns:
      the result of execution