1 package polyglot.frontend; 2 3 4 public abstract class AbstractPass implements Pass 5 { 6 7 protected Pass.ID id; 8 9 14 protected long exclusive_time = 0; 15 16 21 protected long inclusive_time = 0; 22 23 public AbstractPass(Pass.ID id) { 24 this.id = id; 25 } 26 27 28 public Pass.ID id() { 29 return id; 30 } 31 32 33 public String name() { 34 return id.toString(); 35 } 36 37 38 public abstract boolean run(); 39 40 41 public void toggleTimers(boolean exclusive_only) { 42 if (! exclusive_only) { 49 inclusive_time = System.currentTimeMillis() - inclusive_time; 50 } 51 exclusive_time = System.currentTimeMillis() - exclusive_time; 52 } 53 54 55 public void resetTimers() { 56 inclusive_time = 0; 57 exclusive_time = 0; 58 } 59 60 62 public long exclusiveTime() { 63 return exclusive_time; 64 } 65 66 68 public long inclusiveTime() { 69 return inclusive_time; 70 } 71 72 public String toString() { 73 return getClass().getName() + ":" + id; 74 } 75 } 76 | Popular Tags |