29
29
import org .exist .xquery .util .ExpressionDumper ;
30
30
import org .exist .xquery .value .Sequence ;
31
31
32
- public class TimerPragma extends AbstractPragma {
33
- public static final String TIMER_PRAGMA_LOCAL_NAME = "timer" ;
34
- public static final QName TIMER_PRAGMA = new QName (TIMER_PRAGMA_LOCAL_NAME , Namespaces .EXIST_NS , "exist" );
32
+ /**
33
+ * An XQuery Pragma that will record the execution
34
+ * time of the associated expression.
35
+ */
36
+ public class TimePragma extends AbstractPragma {
37
+
38
+ public static final String TIME_PRAGMA_LOCAL_NAME = "time" ;
39
+ public static final QName TIME_PRAGMA = new QName (TIME_PRAGMA_LOCAL_NAME , Namespaces .EXIST_NS , "exist" );
40
+ public static final String DEPRECATED_TIMER_PRAGMA_LOCAL_NAME = "timer" ;
35
41
36
42
private Logger log = null ;
37
43
38
44
private long start ;
39
45
private boolean verbose = true ;
40
46
41
- public TimerPragma (final Expression expression , final QName qname , final String contents ) throws XPathException {
47
+ public TimePragma (final Expression expression , final QName qname , final String contents ) throws XPathException {
42
48
super (expression , qname , contents );
43
49
if (contents != null && !contents .isEmpty ()) {
44
50
45
51
final String [] options = Option .tokenize (contents );
46
52
for (final String option : options ) {
47
53
final String [] param = Option .parseKeyValuePair (option );
48
54
if (param == null ) {
49
- throw new XPathException ((Expression ) null , "Invalid content found for pragma " + TIMER_PRAGMA .getStringValue () + ": " + contents );
55
+ throw new XPathException ((Expression ) null , "Invalid content found for pragma " + TIME_PRAGMA .getStringValue () + ": " + contents );
50
56
}
51
57
52
58
if ("verbose" .equals (param [0 ])) {
@@ -57,7 +63,7 @@ public TimerPragma(final Expression expression, final QName qname, final String
57
63
}
58
64
}
59
65
if (log == null ) {
60
- log = LogManager .getLogger (TimerPragma .class );
66
+ log = LogManager .getLogger (TimePragma .class );
61
67
}
62
68
}
63
69
0 commit comments