Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 23 24 package stat; 25 26 import org.objectweb.fractal.julia.loader.Initializable; 27 import org.objectweb.fractal.julia.loader.Tree; 28 29 public class StatControllerImpl implements Initializable, StatController { 30 31 34 35 private int calls; 36 37 43 44 private int success; 45 46 49 50 private int reads; 51 52 55 56 private int writes; 57 58 61 62 private long totalTime; 63 64 67 68 private boolean reset; 69 70 72 public void initialize (final Tree args) { 73 String s = args.getSubTree(0).toString(); 74 if (s.equals("on")) { 75 reset = true; 76 } 77 } 78 79 81 public int getNumberOfMethodCall () { 82 int calls = this.calls; 83 if (reset) { 84 this.calls = 0; 85 } 86 return calls; 87 } 88 89 public int getNumberOfMethodSuccess () { 90 int success = this.success; 91 if (reset) { 92 this.success = 0; 93 } 94 return success; 95 } 96 97 public int getNumberOfFieldRead () { 98 int reads = this.reads; 99 if (reset) { 100 this.reads = 0; 101 } 102 return reads; 103 } 104 105 public int getNumberOfFieldWrite () { 106 int writes = this.writes; 107 if (reset) { 108 this.writes = 0; 109 } 110 return writes; 111 } 112 113 public long getTotalExecutionTime () { 114 long totalTime = this.totalTime; 115 if (reset) { 116 this.totalTime = 0; 117 } 118 return totalTime; 119 } 120 121 123 public long preMethod (final String method) { 124 synchronized (this) { 125 ++calls; 126 return System.currentTimeMillis(); 127 } 128 } 129 130 public void postMethod (final String method, long start) { 131 synchronized (this) { 132 ++success; 133 totalTime += System.currentTimeMillis() - start; 134 } 135 } 136 137 public void getField (final String field) { 138 ++reads; 139 } 140 141 public void setField (final String field) { 142 ++writes; 143 } 144 } 145
| Popular Tags
|