Changeset 847


Ignore:
Timestamp:
Dec 20, 2010, 1:48:10 PM (8 years ago)
Author:
lindanl
Message:

DOM driver add with performance measurement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Xerces/samples/src/DOMCount/DOMCount.cpp

    r721 r847  
    4646#endif
    4747
    48 
     48#define BUFFER_PROFILING
     49#define PERF_SCRIPT
     50#include <xercesc/simd_lib/perflib/perfsec.h>
     51#ifdef BUFFER_PROFILING
     52BOM_Table * parser_timer;
     53#endif
     54#include <sys/stat.h>
     55// ------
    4956// ---------------------------------------------------------------------------
    5057//  This is a simple program which invokes the DOMParser to build a DOM
     
    138145    }
    139146
     147    struct stat fileinfo;
    140148    const char*                xmlFile = 0;
    141     AbstractDOMParser::ValSchemes valScheme = AbstractDOMParser::Val_Auto;
     149    AbstractDOMParser::ValSchemes valScheme = AbstractDOMParser::Val_Never;
    142150    bool                       doNamespaces       = false;
    143151    bool                       doSchema           = false;
     
    271279    config->setParameter(XMLUni::fgXercesHandleMultipleImports, true);
    272280    config->setParameter(XMLUni::fgXercesSchemaFullChecking, schemaFullChecking);
     281    parser->getDomConfig()->setParameter(
     282     XMLUni::fgXercesScannerName, (void *)XMLUni::fgWFXMLScanner);
    273283
    274284    if (valScheme == AbstractDOMParser::Val_Auto)
     
    310320    }
    311321
     322    PERF_SEC_INIT(parser_timer);
    312323    while (more)
    313324    {
     
    339350        XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc = 0;
    340351
     352                stat(xmlFile, &fileinfo);
     353
    341354        try
    342355        {
     
    345358
    346359            const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis();
     360            PERF_SEC_START(parser_timer);
    347361            doc = parser->parseURI(xmlFile);
     362            PERF_SEC_END(parser_timer, fileinfo.st_size);
    348363            const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
    349364            duration = endMillis - startMillis;
     
    402417
    403418            // Print out the stats that we collected and time taken.
    404             XERCES_STD_QUALIFIER cout << xmlFile << ": " << duration << " ms ("
    405                  << elementCount << " elems)." << XERCES_STD_QUALIFIER endl;
    406         }
    407     }
    408 
     419//             XERCES_STD_QUALIFIER cout << xmlFile << ": " << duration << " ms ("
     420//                  << elementCount << " elems)." << XERCES_STD_QUALIFIER endl;
     421        }
     422    }
     423    PERF_SEC_DUMP(parser_timer);
    409424    //
    410425    //  Delete the parser itself.  Must be done prior to calling Terminate, below.
Note: See TracChangeset for help on using the changeset viewer.