11/*
2+ * Elemental
3+ * Copyright (C) 2024, Evolved Binary Ltd
4+ *
5+ * admin@evolvedbinary.com
6+ * https://www.evolvedbinary.com | https://www.elemental.xyz
7+ *
8+ * This library is free software; you can redistribute it and/or
9+ * modify it under the terms of the GNU Lesser General Public
10+ * License as published by the Free Software Foundation; version 2.1.
11+ *
12+ * This library is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+ * Lesser General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU Lesser General Public
18+ * License along with this library; if not, write to the Free Software
19+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+ *
21+ * NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+ * The original license header is included below.
23+ *
24+ * =====================================================================
25+ *
226 * eXist-db Open Source Native XML Database
327 * Copyright (C) 2001 The eXist-db Authors
428 *
1943 * License along with this library; if not, write to the Free Software
2044 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2145 */
22-
2346package org .exist .xquery ;
2447
2548import org .exist .Database ;
@@ -316,9 +339,10 @@ private FunctionStats[] sort() {
316339 return stats ;
317340 }
318341
319- public synchronized void toXML (MemTreeBuilder builder ) {
342+ public synchronized void toXML (final MemTreeBuilder builder ) {
320343 final AttributesImpl attrs = new AttributesImpl ();
321- builder .startElement (new QName ("calls" , XML_NAMESPACE , XML_PREFIX ), null );
344+ attrs .addAttribute ("" , "tracing-enabled" , "tracing-enabled" , "CDATA" , Boolean .toString (isEnabled ()));
345+ builder .startElement (new QName ("calls" , XML_NAMESPACE , XML_PREFIX ), attrs );
322346 for (final QueryStats stats : queries .values ()) {
323347 attrs .clear ();
324348 attrs .addAttribute ("" , "source" , "source" , "CDATA" , stats .source );
@@ -332,20 +356,19 @@ public synchronized void toXML(MemTreeBuilder builder) {
332356 attrs .addAttribute ("" , "name" , "name" , "CDATA" , stats .qname .getStringValue ());
333357 attrs .addAttribute ("" , "elapsed" , "elapsed" , "CDATA" , Double .toString (stats .executionTime / 1000.0 ));
334358 attrs .addAttribute ("" , "calls" , "calls" , "CDATA" , Integer .toString (stats .callCount ));
335- if (stats .source != null )
336- {attrs .addAttribute ("" , "source" , "source" , "CDATA" , stats .source );}
359+ if (stats .source != null ) {
360+ attrs .addAttribute ("" , "source" , "source" , "CDATA" , stats .source );
361+ }
337362 builder .startElement (new QName ("function" , XML_NAMESPACE , XML_PREFIX ), attrs );
338363 builder .endElement ();
339364 }
340365 for (final IndexStats stats : indexStats .values ()) {
341366 attrs .clear ();
342367 attrs .addAttribute ("" , "type" , "type" , "CDATA" , stats .indexType );
343- attrs .addAttribute ("" , "source" , "source" , "CDATA" , stats .source + " [" + stats .line + ":" +
344- stats .column + "]" );
368+ attrs .addAttribute ("" , "source" , "source" , "CDATA" , stats .source + " [" + stats .line + ":" + stats .column + "]" );
345369 attrs .addAttribute ("" , "elapsed" , "elapsed" , "CDATA" , Double .toString (stats .executionTime / 1000.0 ));
346370 attrs .addAttribute ("" , "calls" , "calls" , "CDATA" , Integer .toString (stats .usageCount ));
347- attrs .addAttribute ("" , "optimization" , "optimization" , "CDATA" ,
348- Integer .toString (stats .mode ));
371+ attrs .addAttribute ("" , "optimization" , "optimization" , "CDATA" , Integer .toString (stats .mode ));
349372 builder .startElement (new QName ("index" , XML_NAMESPACE , XML_PREFIX ), attrs );
350373 builder .endElement ();
351374 }
0 commit comments