Changeset 875


Ignore:
Timestamp:
Jan 7, 2011, 3:51:32 PM (8 years ago)
Author:
lindanl
Message:

SAXCount with performance test script.

File:
1 edited

Legend:

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

    r721 r875  
    3232#include <xercesc/util/OutOfMemoryException.hpp>
    3333
     34#define PERF_SCRIPT
     35#define BUFFER_PROFILING
     36#include <xercesc/simd_lib/perflib/perfsec.h>
     37#ifdef BUFFER_PROFILING
     38BOM_Table * parser_timer;
     39#endif
     40#include <sys/stat.h>
    3441// ---------------------------------------------------------------------------
    3542//  Local helper methods
     
    6976    }
    7077
     78    struct stat fileinfo;
    7179    const char*              xmlFile = 0;
    7280    SAXParser::ValSchemes    valScheme = SAXParser::Val_Auto;
     
    197205    parser->setValidationSchemaFullChecking(schemaFullChecking);
    198206
     207    parser->useScanner(XMLUni::fgWFXMLScanner);
     208
    199209    //
    200210    //  Create our SAX handler object and install it on the parser, as the
     
    222232        return 2;
    223233    }
     234
     235    PERF_SEC_INIT(parser_timer);
    224236
    225237    while (true)
     
    254266        //reset error count first
    255267        handler.resetErrors();
    256 
     268                stat(xmlFile, &fileinfo);
    257269        try
    258270        {
    259271            const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis();
     272
     273            PERF_SEC_START(parser_timer);
    260274            parser->parse(xmlFile);
     275            PERF_SEC_END(parser_timer, fileinfo.st_size);
     276
    261277            const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
    262278            duration = endMillis - startMillis;
     
    286302
    287303        // Print out the stats that we collected and time taken
    288         if (!handler.getSawErrors())
     304/*        if (!handler.getSawErrors())
    289305        {
    290306            XERCES_STD_QUALIFIER cout << xmlFile << ": " << duration << " ms ("
     
    295311        }
    296312        else
    297             errorOccurred = true;
    298     }
     313            errorOccurred = true;*/
     314    }
     315
     316    PERF_SEC_DUMP(parser_timer);
    299317
    300318    if (doList)
Note: See TracChangeset for help on using the changeset viewer.