@@ -75,7 +75,15 @@ public class Env implements Map<String, Object>, Serializable {
7575 public static final Map <String , Object > EMPTY_ENV = Collections .emptyMap ();
7676
7777 // The execution start timestamp in nanoseconds.
78- private transient long startNs = -1 ;
78+ private long startNs = -1 ;
79+
80+ public static class IntCounter {
81+ transient int n = 0 ;
82+ }
83+
84+ // The "execution" checkpoint times
85+ private transient IntCounter checkPoints = null ;
86+
7987
8088
8189 /**
@@ -103,10 +111,23 @@ public void setmOverrides(final Map<String, Object> mOverrides) {
103111 this .mOverrides = mOverrides ;
104112 }
105113
114+
106115 public long getStartNs () {
107116 return startNs ;
108117 }
109118
119+ public int incExecCheckpointsAndGet () {
120+ if (this .checkPoints == null ) {
121+ checkPoints = new IntCounter ();
122+ }
123+ return ++checkPoints .n ;
124+ }
125+
126+
127+ public IntCounter getCheckPoints () {
128+ return checkPoints ;
129+ }
130+
110131 public List <String > getImportedSymbols () {
111132 return this .importedSymbols ;
112133 }
@@ -156,16 +177,17 @@ public void setInstance(final AviatorEvaluatorInstance instance) {
156177 }
157178
158179 // Configure the env.
159- public void configure (final AviatorEvaluatorInstance instance , final Expression exp ,
160- long startNs ) {
180+ public void configure (final AviatorEvaluatorInstance instance , final Expression exp , long startNs ,
181+ IntCounter checkPoints ) {
161182 this .instance = instance ;
162183 this .expression = exp ;
163- setStartNs (startNs );
184+ setStats (startNs , checkPoints );
164185 }
165186
166- private void setStartNs (long startNs ) {
187+ private void setStats (long startNs , IntCounter checkPoints ) {
167188 if (this .startNs == -1 && startNs > 0 ) {
168189 this .startNs = startNs ;
190+ this .checkPoints = checkPoints ;
169191 }
170192 }
171193
0 commit comments