Class SimpleActivity

  • Field Details

  • Constructor Details

  • Method Details

    • initActivity

      public void initActivity()
      Specified by:
      initActivity in interface Activity
    • getErrorHandler

      public NBErrorHandler getErrorHandler()
    • getRunState

      public RunState getRunState()
      Specified by:
      getRunState in interface Activity
      Specified by:
      getRunState in interface StateCapable
    • setRunState

      public void setRunState(RunState runState)
      Specified by:
      setRunState in interface Activity
    • getStartedAtMillis

      public long getStartedAtMillis()
      Specified by:
      getStartedAtMillis in interface Activity
    • getMotorDispenserDelegate

      public final MotorDispenser<?> getMotorDispenserDelegate()
      Specified by:
      getMotorDispenserDelegate in interface Activity
    • setMotorDispenserDelegate

      public final void setMotorDispenserDelegate(MotorDispenser<?> motorDispenser)
      Specified by:
      setMotorDispenserDelegate in interface Activity
    • getInputDispenserDelegate

      public final InputDispenser getInputDispenserDelegate()
      Specified by:
      getInputDispenserDelegate in interface Activity
    • setInputDispenserDelegate

      public final void setInputDispenserDelegate(InputDispenser inputDispenser)
      Specified by:
      setInputDispenserDelegate in interface Activity
    • getActionDispenserDelegate

      public final ActionDispenser getActionDispenserDelegate()
      Specified by:
      getActionDispenserDelegate in interface Activity
    • setActionDispenserDelegate

      public final void setActionDispenserDelegate(ActionDispenser actionDispenser)
      Specified by:
      setActionDispenserDelegate in interface Activity
    • getResultFilterDispenserDelegate

      public IntPredicateDispenser getResultFilterDispenserDelegate()
      Specified by:
      getResultFilterDispenserDelegate in interface Activity
    • setResultFilterDispenserDelegate

      public void setResultFilterDispenserDelegate(IntPredicateDispenser resultFilterDispenser)
      Specified by:
      setResultFilterDispenserDelegate in interface Activity
    • getMarkerDispenserDelegate

      public OutputDispenser getMarkerDispenserDelegate()
      Specified by:
      getMarkerDispenserDelegate in interface Activity
    • setOutputDispenserDelegate

      public void setOutputDispenserDelegate(OutputDispenser outputDispenser)
      Specified by:
      setOutputDispenserDelegate in interface Activity
    • getActivityDef

      public ActivityDef getActivityDef()
      Specified by:
      getActivityDef in interface Activity
    • toString

      public String toString()
      Overrides:
      toString in class NBBaseComponent
    • compareTo

      public int compareTo(Activity o)
      Specified by:
      compareTo in interface Comparable<Activity>
    • registerAutoCloseable

      public void registerAutoCloseable(AutoCloseable closeable)
      Description copied from interface: Activity
      Register an object which should be closed after this activity is shutdown.
      Specified by:
      registerAutoCloseable in interface Activity
      Parameters:
      closeable - An Autocloseable object
    • closeAutoCloseables

      public void closeAutoCloseables()
      Description copied from interface: Activity
      Close all autocloseables that have been registered with this Activity.
      Specified by:
      closeAutoCloseables in interface Activity
    • getCycleLimiter

      public RateLimiter getCycleLimiter()
      Description copied from interface: Activity
      Get the current cycle rate limiter for this activity. The cycle rate limiter is used to throttle the rate at which cycles are dispatched across all threads in the activity
      Specified by:
      getCycleLimiter in interface Activity
      Returns:
      the cycle RateLimiter
    • getStrideLimiter

      public RateLimiter getStrideLimiter()
      Description copied from interface: Activity
      Get the current stride rate limiter for this activity. The stride rate limiter is used to throttle the rate at which new strides are dispatched across all threads in an activity.
      Specified by:
      getStrideLimiter in interface Activity
      Returns:
      The stride RateLimiter
    • getInstrumentation

      public ActivityInstrumentation getInstrumentation()
      Description copied from interface: Activity
      Get or create the instrumentation needed for this activity. This provides a single place to find and manage, and document instrumentation that is uniform across all activities.
      Specified by:
      getInstrumentation in interface Activity
      Returns:
      A new or existing instrumentation object for this activity.
    • getConsoleOut

      public PrintWriter getConsoleOut()
      Specified by:
      getConsoleOut in interface Activity
    • getConsoleIn

      public InputStream getConsoleIn()
      Specified by:
      getConsoleIn in interface Activity
    • setConsoleOut

      public void setConsoleOut(PrintWriter writer)
      Specified by:
      setConsoleOut in interface Activity
    • getExceptionMetrics

      public ErrorMetrics getExceptionMetrics()
      Specified by:
      getExceptionMetrics in interface Activity
    • onActivityDefUpdate

      public void onActivityDefUpdate(ActivityDef activityDef)
      Specified by:
      onActivityDefUpdate in interface ActivityDefObserver
    • initOrUpdateRateLimiters

      public void initOrUpdateRateLimiters(ActivityDef activityDef)
    • createOrUpdateStrideLimiter

      public void createOrUpdateStrideLimiter(SimRateSpec spec)
    • createOrUpdateCycleLimiter

      public void createOrUpdateCycleLimiter(SimRateSpec spec)
    • setDefaultsFromOpSequence

      public void setDefaultsFromOpSequence(OpSequence<?> seq)
      Modify the provided ActivityDef with defaults for stride and cycles, if they haven't been provided, based on the length of the sequence as determined by the provided ratios. Also, modify the ActivityDef with reasonable defaults when requested.
      Parameters:
      seq - - The OpSequence to derive the defaults from
    • createOpSourceFromParsedOps

      protected <O extends LongFunction> OpSequence<OpDispenser<? extends CycleOp<?>>> createOpSourceFromParsedOps(List<DriverAdapter<CycleOp<?>,Space>> adapters, List<ParsedOp> pops)
    • loadOpTemplates

      protected List<OpTemplate> loadOpTemplates(DriverAdapter<?,?> defaultDriverAdapter)
    • createOpSequence

      @Deprecated(forRemoval=true) protected <O> OpSequence<OpDispenser<? extends O>> createOpSequence(Function<OpTemplate,OpDispenser<? extends O>> opinit, boolean strict, DriverAdapter<?,?> defaultAdapter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Given a function that can create an op of type from an OpTemplate, generate an indexed sequence of ready to call operations.

      This method uses the following conventions to derive the sequence:

      1. If an 'op', 'stmt', or 'statement' parameter is provided, then it's value is taken as the only provided statement.
      2. If a 'yaml, or 'workload' parameter is provided, then the statements in that file are taken with their ratios
      3. Any provided tags filter is used to select only the op templates which have matching tags. If no tags are provided, then all the found op templates are included.
      4. The ratios and the 'seq' parameter are used to build a sequence of the ready operations, where the sequence length is the sum of the ratios.
      Type Parameters:
      O - A holder for an executable operation for the native driver used by this activity.
      Parameters:
      opinit - A function to map an OpTemplate to the executable operation form required by the native driver for this activity.
      defaultAdapter - The adapter which will be used for any op templates with no explicit adapter
      Returns:
      The sequence of operations as determined by filtering and ratios
    • loadStmtsDocList

      protected OpsDocList loadStmtsDocList()
    • getProgressMeter

      public ProgressMeterDisplay getProgressMeter()
      Specified by:
      getProgressMeter in interface ProgressCapable
    • getMaxTries

      public int getMaxTries()
      Activities with retryable operations (when specified with the retry error handler for some types of error), should allow the user to specify how many retries are allowed before giving up on the operation.
      Specified by:
      getMaxTries in interface Activity
      Returns:
      The number of allowable retries
    • getRunStateTally

      public RunStateTally getRunStateTally()
      Specified by:
      getRunStateTally in interface Activity
    • asResult

      public Map<String,String> asResult()
      Specified by:
      asResult in interface InvokableResult