X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=SXSIStorageInterface.cpp;fp=SXSIStorageInterface.cpp;h=af7ba7fa97bc04093dffe567c015925973f16e85;hb=24fdea81b5506233d139bd7d72364a190bef35b8;hp=5df826bd3e3aaf68e3083c650ab917c662e5ec6f;hpb=496df5f7d3e6f8271763314f2067719cc2904c71;p=SXSI%2Fxpathcomp.git diff --git a/SXSIStorageInterface.cpp b/SXSIStorageInterface.cpp index 5df826b..af7ba7f 100644 --- a/SXSIStorageInterface.cpp +++ b/SXSIStorageInterface.cpp @@ -16,6 +16,7 @@ SXSIStorageInterface::SXSIStorageInterface() { tree = new XMLTree(); tree->OpenDocument(true,64); + } SXSIStorageInterface::~SXSIStorageInterface() @@ -24,16 +25,23 @@ SXSIStorageInterface::~SXSIStorageInterface() void SXSIStorageInterface::newChild(string name) { + _new_child++; tree->NewOpenTag((unsigned char*) name.c_str()); } void SXSIStorageInterface::newText(string text) { - if (text.empty()) + + if (text.empty()) { + _new_empty_text++; tree->NewEmptyText(); - else + } + else { + _new_text++; + _length_text += text.size(); tree->NewText((unsigned char*) text.c_str()); + } } @@ -45,12 +53,25 @@ void SXSIStorageInterface::nodeFinished(string name) void SXSIStorageInterface::parsingFinished() { - tree->CloseDocument(); + + tree->CloseDocument(); } void *SXSIStorageInterface::returnDocument(){ + printStats(); return ((void *) tree); } +void SXSIStorageInterface::printStats(){ + std::cerr << "Parsing stats : \n"; + std::cerr << _new_child << " calls to newOpenTag/newClosingTag\n"; + std::cerr << _new_text << " calls to newText\n"; + std::cerr << _new_empty_text << " calls to newEmptyText\n"; + std::cerr << _length_text << " bytes (=" << _length_text/1024 << "kb ) added to TextCollection\n"; + std::cerr << _heap_base << " bytes of memory (initial)\n"; + std::cerr << _heap_parsing << " bytes of memory (during parsing)\n"; + std::cerr << _heap_done << " bytes of memory (final)\n"; + return; +}