@Override
    protected void initialize() {

      SharedResource shared = new SharedResource();

      MyPEH1 myPEH1 =
          new MyPEH1(
              new PriorityParameters(12),
              new PeriodicParameters(
                  new RelativeTime(Clock.getRealtimeClock()),
                  new RelativeTime(50, 0, Clock.getRealtimeClock())),
              storageParameters_Handlers,
              shared,
              this);
      myPEH1.register();

      PeriodicEventHandler myPEH2 =
          new MyPEH2(
              new PriorityParameters(12),
              new PeriodicParameters(
                  new RelativeTime(0, 0, Clock.getRealtimeClock()),
                  new RelativeTime(50, 0, Clock.getRealtimeClock())),
              storageParameters_Handlers,
              shared);
      myPEH2.register();

      Services.setCeiling(shared, 12);
    }
Пример #2
0
  private PriorityScheduler() {
    int[] schedulerStack = new int[Const.PRIORITY_SCHEDULER_STACK_SIZE];

    this.pFrame = new PriorityFrame(Const.DEFAULT_PRIORITY_QUEUE_SIZE);

    this.prioritySchedulerImpl = new PrioritySchedulerImpl();

    vm.ClockInterruptHandler.initialize(this.prioritySchedulerImpl, schedulerStack);

    this.rtClock = Clock.getRealtimeClock();
    this.now = new AbsoluteTime(this.rtClock);
    rtClock.getTime(this.now);

    this.timeGrain = new RelativeTime(0, 0, this.rtClock);
    rtClock.getResolution(this.timeGrain);
    scheduler = this;
  }
Пример #3
0
  public void addEvent(String message) {

    if (Const.ENABLE_LOG) {
      Clock.getRealtimeClock().getTime(ImmortalEntry.clk);

      logMilis[i] = ImmortalEntry.clk.getMilliseconds();
      logNanos[i] = ImmortalEntry.clk.getNanoseconds();
      logEvent[i] = message;

      i++;

      if (i == Const.MAX_LOG_EVENTS) {
        i = 0;
      }

      if (ImmortalEntry.eventsLogged < Const.MAX_LOG_EVENTS) {
        ImmortalEntry.eventsLogged++;
      }
    }
  }