X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=XMLTree.cpp;h=6fee8f4673d8a825a107e310d7e34c0de1d0ab79;hb=82b89c86269e04916a4aef964977ee738d8f2927;hp=e17c89d90358731f2cbad205b9c5a4534f96af76;hpb=d6ecf291b7dd99ec191daa090a2ff3dac08f8150;p=SXSI%2FXMLTree.git diff --git a/XMLTree.cpp b/XMLTree.cpp index e17c89d..6fee8f4 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -67,6 +67,16 @@ inline void * umalloc(size_t size){ return dest; } +void XMLTree::print_stats() { + uint total_space = Tags->size()+sizeof(static_sequence*); + total_space += sizeof(uint*)+sizeof(uint)*(2+uint_len(tags_blen,tags_len)); + cout << "Space usage for XMLTree:" << endl + << " - tags static_sequence: " << Tags->size()+sizeof(static_sequence*) << endl + << " - tags access array: " << sizeof(uint*)+sizeof(uint)*(2+uint_len(tags_blen,tags_len)) << endl + << " ... add Diego structures ... " << endl + << " *total* " << total_space << endl; +} + // Save: saves XML tree data structure to file. void XMLTree::Save(unsigned char *filename) { @@ -230,13 +240,14 @@ XMLTree *XMLTree::Load(unsigned char *filename, int sample_rate_text) fclose(fp); - std::cerr << "Tree part is " << s_tree/1024 << " Kbytes,\n" + /*std::cerr << "Tree part is " << s_tree/1024 << " Kbytes,\n" << "with node->tagid part " << XML_Tree->Tags->size()/1024+(uint_len(XML_Tree->tags_blen,XML_Tree->tags_len)*sizeof(uint))/1024 << "Kbytes \n" << "size of Tag part : " << XML_Tree->Tags->length () << " elements\n" << "sizof(unsigned int)* " << XML_Tree->Tags->length () << " = " << sizeof(unsigned int) * XML_Tree->Tags->length () / 1024 << " Kbytes\n" << "Tag part is " << s_tags/1024 << " Kbytes,\n" - << "Text collection is " << s_text/1024 << " Kbytes \n"; + << "Text collection is " << s_text/1024 << " Kbytes \n";*/ + XML_Tree->print_stats(); return XML_Tree; } @@ -887,6 +898,7 @@ int XMLTree::CloseDocument() tags_aux = NULL; finished = true; + print_stats(); return 1; // indicates success in the inicialization }