From: Martin Liska Date: Wed, 5 Sep 2018 08:08:45 +0000 (+0200) Subject: GCOV: Print one decimal place in human readable mode. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1c772b9bb4053ff15ddbf2fadf8f6ad8210dc4e;p=gcc.git GCOV: Print one decimal place in human readable mode. 2018-09-05 Martin Liska * doc/gcov.texi: Update documentation of humar readable mode. * gcov.c (format_count): Print one decimal place, it provides more fine number of situations like '1G' vs. '1.4G'. 2018-09-05 Martin Liska * g++.dg/gcov/loop.C: Update test to support new format. From-SVN: r264112 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce7a3b13700..4011ba616af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-09-05 Martin Liska + + * doc/gcov.texi: Update documentation of humar + readable mode. + * gcov.c (format_count): Print one decimal place, it provides + more fine number of situations like '1G' vs. '1.4G'. + 2018-09-05 Martin Liska PR target/87164 diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index f33dc8f6aed..98f4a876293 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -255,7 +255,7 @@ lcount:36,1,0 @item -j @itemx --human-readable -Write counts in human readable format (like 24k). +Write counts in human readable format (like 24.6k). @item -k @itemx --use-colors diff --git a/gcc/gcov.c b/gcc/gcov.c index ff4020c713e..6a24a320046 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -2216,8 +2216,8 @@ format_count (gcov_type count) if (count + divisor / 2 < 1000 * divisor) break; } - gcov_type r = (count + divisor / 2) / divisor; - sprintf (buffer, "%" PRId64 "%c", r, units[i]); + float r = 1.0f * count / divisor; + sprintf (buffer, "%.1f%c", r, units[i]); return buffer; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b3578f38f2..b4ee15292d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-09-05 Martin Liska + + * g++.dg/gcov/loop.C: Update test to support new format. + 2018-09-04 H.J. Lu PR debug/86593 diff --git a/gcc/testsuite/g++.dg/gcov/loop.C b/gcc/testsuite/g++.dg/gcov/loop.C index 7f3be5587af..24f580634d9 100644 --- a/gcc/testsuite/g++.dg/gcov/loop.C +++ b/gcc/testsuite/g++.dg/gcov/loop.C @@ -2,11 +2,11 @@ /* { dg-do run { target native } } */ unsigned -loop (unsigned n, int value) /* count(14k) */ +loop (unsigned n, int value) /* count(14.0k) */ { for (unsigned i = 0; i < n - 1; i++) { - value += i; /* count(21M) */ + value += i; /* count(21.0M) */ } return value; @@ -18,7 +18,7 @@ int main(int argc, char **argv) for (unsigned i = 0; i < 7 * 1000; i++) { sum += loop (1000, sum); - sum += loop (2000, sum); /* count(7k) */ + sum += loop (2000, sum); /* count(7.0k) */ } return 0; /* count(1) */