Package edu.vt.realtime

Examples of edu.vt.realtime.Timespec


    return amount >= 0;
  }
 
  @Override
  public Integer checkBalance(long deadlineSec, long deadlineNSec, long period_tsSec, long period_tsNSec){
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    deadline.setTime(period_tsSec, period_tsNSec);
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 0, deadline, period_ts, 0);
    Integer result = amount;
    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
    return result;
View Full Code Here


    return result;
  }
 
  @Override
  public void deposit(int dollars, long deadlineSec, long deadlineNSec, long period_tsSec, long period_tsNSec){
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    deadline.setTime(period_tsSec, period_tsNSec);
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 0, deadline, period_ts, 0);
    amount = amount + dollars;
    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
  }
View Full Code Here

    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
  }

  @Override
  public boolean withdraw(int dollars, long deadlineSec, long deadlineNSec, long period_tsSec, long period_tsNSec){
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    deadline.setTime(period_tsSec, period_tsNSec);
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 0, deadline, period_ts, 0);
    amount = amount - dollars;
    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
View Full Code Here

 
  public static long getTotalBalance(Timespec deadline, Timespec period_ts, String[] lockedAccounts, String subAccountNum1, String subAccountNum2) {
    IBankAccount subAccount1 = null;
    IBankAccount subAccount2  = null;
    Address server1 = null, server2 = null;
    Timespec currenttime = new Timespec();
    char num1 = subAccountNum1.split("-")[1].charAt(0);
    char num2 = subAccountNum2.split("-")[1].charAt(0);
    boolean locked1 = false;
    boolean locked2 = false;
    String strAccount1, strAccount2;
View Full Code Here

  public static boolean transfer(Timespec deadline, Timespec period_ts, String[] lockedAccounts, String subAccountNum1, String subAccountNum2, int amount) {

    IBankAccount subAccount1 = null;
    IBankAccount subAccount2  = null;
    Address server1 = null, server2 = null;
    Timespec currenttime = new Timespec();
    char num1 = subAccountNum1.split("-")[1].charAt(0);
    char num2 = subAccountNum2.split("-")[1].charAt(0);
    boolean locked1 = false;
    boolean locked2 = false;
    String strAccount1, strAccount2;
View Full Code Here

    boolean timedout = false;
    long timeoutPeriod = edu.vt.rt.hyflow.benchmark.Benchmark.timout();
    int count =0;
    //this.aborts = ChronosScheduler.initAborts();
    //this.aborts = edu.vt.rt.hyflow.benchmark.Benchmark.getAbortHandler();
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    period_ts.setTime(period_tsSec, period_tsNSec);
   
    Timespec currenttime = new Timespec();
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 2, deadline, period_ts, 0);

    if(!rlock.tryAcquire(timeoutPeriod, TimeUnit.MILLISECONDS))
    while(!rlock.tryAcquire(timeoutPeriod, TimeUnit.MILLISECONDS)) {
      currenttime.getTime();
      if(currenttime.greaterThan(deadline)) {
        timedout = true;
        break;
      }
      count++;
    }
View Full Code Here

    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
  }
 
  @Override
  public Integer checkBalance(long deadlineSec, long deadlineNSec, long period_tsSec, long period_tsNSec){
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    deadline.setTime(period_tsSec, period_tsNSec);
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 0, deadline, period_ts, 0);
    Integer result = amount;
    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
    return result;
View Full Code Here

    return result;
  }
 
  @Override
  public void deposit(int dollars, long deadlineSec, long deadlineNSec, long period_tsSec, long period_tsNSec){
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    deadline.setTime(period_tsSec, period_tsNSec);
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 0, deadline, period_ts, 0);
    amount = amount + dollars;
    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
  }
View Full Code Here

    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
  }

  @Override
  public boolean withdraw(int dollars, long deadlineSec, long deadlineNSec, long period_tsSec, long period_tsNSec){
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    deadline.setTime(period_tsSec, period_tsNSec);
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 0, deadline, period_ts, 0);
    amount = amount - dollars;
    ChronosScheduler.endSegment(Priorities.TASK_CLEANUP.getNativeId());
View Full Code Here

    boolean timedout = false;
    long timeoutPeriod = edu.vt.rt.hyflow.benchmark.Benchmark.timout();
    int count =0;
    //this.aborts = ChronosScheduler.initAborts();
    //this.aborts = edu.vt.rt.hyflow.benchmark.Benchmark.getAbortHandler();
    Timespec deadline = new Timespec();
    deadline.setTime(deadlineSec, deadlineNSec);
    Timespec period_ts = new Timespec();
    period_ts.setTime(period_tsSec, period_tsNSec);
   
    Timespec currenttime = new Timespec();
    ChronosScheduler.beginSegment(Priorities.TASK_RUN.getNativeId(), 2, deadline, period_ts, 0);

    while(!wlock.compareAndSet(false, true)){     
      currenttime.getTime();
      if(currenttime.greaterThan(deadline)) {
        timedout = true;
        break;
      }
      count++;
    }
View Full Code Here

TOP

Related Classes of edu.vt.realtime.Timespec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.