X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=SXSIStorageInterface.cpp;h=af7ba7fa97bc04093dffe567c015925973f16e85;hb=b821684aac2e3114c2eb28188020d7a09b5de2a5;hp=14c1d703cf7e8f94be3912e98cb3caef68fb236d;hpb=9be0c0e2a5597148fdc3a3cca2bdaf69da0aa27d;p=SXSI%2Fxpathcomp.git diff --git a/SXSIStorageInterface.cpp b/SXSIStorageInterface.cpp index 14c1d70..af7ba7f 100644 --- a/SXSIStorageInterface.cpp +++ b/SXSIStorageInterface.cpp @@ -15,7 +15,8 @@ SXSIStorageInterface::SXSIStorageInterface() { tree = new XMLTree(); - tree->OpenDocument(true,1); + tree->OpenDocument(true,64); + } SXSIStorageInterface::~SXSIStorageInterface() @@ -24,40 +25,53 @@ SXSIStorageInterface::~SXSIStorageInterface() void SXSIStorageInterface::newChild(string name) { - cerr << "New child " << name << "\n"; + _new_child++; tree->NewOpenTag((unsigned char*) name.c_str()); } void SXSIStorageInterface::newText(string text) { - if (text.empty()){ - cerr << "Calling newEmptyText()\n"; + + if (text.empty()) { + _new_empty_text++; tree->NewEmptyText(); } else { - cerr << "Calling newText(" << text <<")\n"; - tree->NewText((unsigned char*) text.c_str()); - - }; + _new_text++; + _length_text += text.size(); + tree->NewText((unsigned char*) text.c_str()); + } } void SXSIStorageInterface::nodeFinished(string name) { - cerr << "Node Finished child " << name << "\n"; - tree->NewClosingTag((unsigned char*) name.c_str()); + tree->NewClosingTag((unsigned char*) name.c_str()); } 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; +}