From: Dave J. <da...@us...> - 2002-01-14 11:39:02
|
Update of /cvsroot/oprofile/oprofile/pp In directory usw-pr-cvs1:/tmp/cvs-serv7645/pp Modified Files: op_time.cpp Log Message: * pp/op_time.cpp: fix for printing (NaN%) in the zero sample case. Index: op_time.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/op_time.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- op_time.cpp 2002/01/11 14:41:33 1.7 +++ op_time.cpp 2002/01/14 11:38:59 1.8 @@ -194,10 +194,15 @@ static void out_filename(const string& app_name, size_t app_count, u32 count, double total_count) { - cout << demangle_filename(app_name) << " " << count << " " - << (count / total_count) * 100 << "%"; + cout << demangle_filename(app_name) << " " << count << " "; - if (app_count != size_t(-1)) + if (total_count > 1) { + cout << (count / total_count) * 100 << "%"; + } else { + cout << "0%"; + } + + if (app_count != size_t(-1) && (app_count!=0)) cout << " (" << (count / double(app_count)) * 100 << "%)"; cout << endl; |