From: John L. <mov...@us...> - 2003-10-20 01:03:41
|
Update of /cvsroot/oprofile/oprofile/libpp In directory sc8-pr-cvs1:/tmp/cvs-serv21525/libpp Modified Files: arrange_profiles.cpp Log Message: allow non matching axes if all class's tid == tgid Index: arrange_profiles.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/arrange_profiles.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -p -d -r1.19 -r1.20 --- arrange_profiles.cpp 18 Oct 2003 12:02:41 -0000 1.19 +++ arrange_profiles.cpp 20 Oct 2003 00:54:36 -0000 1.20 @@ -68,6 +68,36 @@ report_error(int axis, int newaxis) } +/** + * check that two different axes are OK - this is only + * allowed if they are TGID,TID and for each class, + * tid == tgid + */ +bool allow_axes(profile_classes const & classes, + axis_types oldaxis, axis_types newaxis) +{ + // No previous axis - OK + if (oldaxis == AXIS_MAX) + return true; + + if (oldaxis != AXIS_TID && oldaxis != AXIS_TGID) + return false; + + if (newaxis != AXIS_TID && newaxis != AXIS_TGID) + return false; + + vector<profile_class>::const_iterator it = classes.v.begin(); + vector<profile_class>::const_iterator const end = classes.v.end(); + + for (; it != end; ++it) { + if (it->ptemplate.tgid != it->ptemplate.tid) + return false; + } + + return true; +} + + /// find the first sample file header in the class opd_header const get_header(profile_class const & pclass) { @@ -193,11 +223,12 @@ void identify_classes(profile_classes & axis_types axis = AXIS_MAX; for (size_t i = 0; i < AXIS_MAX; ++i) { - if (changed[i]) { - if (axis != AXIS_MAX) - report_error(axis, i); - axis = axis_types(i); - } + if (!changed[i]) + continue; + + if (!allow_axes(classes, axis, axis_types(i))) + report_error(axis, i); + axis = axis_types(i); } if (axis == AXIS_MAX) { |