From: Philippe E. <ph...@us...> - 2003-05-18 19:23:08
|
Update of /cvsroot/oprofile/oprofile/libpp In directory sc8-pr-cvs1:/tmp/cvs-serv25706/libpp Modified Files: Tag: pp-interface-branch partition_files.cpp Log Message: merge partition entry when neccessary fixing a corner case when a binary can be a dependent or a primary image and was not merged Index: partition_files.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/Attic/partition_files.cpp,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -u -p -d -r1.1.2.13 -r1.1.2.14 --- partition_files.cpp 17 May 2003 00:18:07 -0000 1.1.2.13 +++ partition_files.cpp 18 May 2003 19:23:04 -0000 1.1.2.14 @@ -152,6 +152,44 @@ partition_files::partition_files(list<st copy(fit->begin(), fit->end(), ostream_iterator<split_sample_filename>(cverb, "")); } + + // In some case a primary image can be dependent such: + // {root}vmlinux and {root}/bin/bash/{dep}/{root}/vmlinux, + // merge_compare() is unable to handle this properly so we must fix it + + if (!merge_by.lib) { + return; + } + + // FIXME: this would be handled in merge_compare() but, until we 'fix' + // daemon to encode primary image as {root}/binary/{dep}/{root}/binary, + // we can't. + // FIXME O(nr_set()*nr_set()) + filename_partition::iterator fend = filenames.end(); + filename_partition::iterator cur; + for (cur = filenames.begin(); cur != fend; ++cur) { + filename_partition::iterator candidate = cur; + for (++candidate; candidate != fend;) { + string image_name; + + // assert(!cur->empty() && !candidate->empty()) + + if (cur->begin()->image == + candidate->begin()->lib_image) { + image_name = cur->begin()->image; + } else if (cur->begin()->lib_image == + candidate->begin()->image) { + image_name = candidate->begin()->image; + } + + if (!image_name.empty()) { + cur->splice(cur->end(), *candidate); + candidate = filenames.erase(candidate); + } else { + ++candidate; + } + } + } } |