]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
GCOV: Print one decimal place in human readable mode.
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Sep 2018 08:08:45 +0000 (08:08 +0000)
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Sep 2018 08:08:45 +0000 (08:08 +0000)
2018-09-05  Martin Liska  <mliska@suse.cz>

* 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  <mliska@suse.cz>

* g++.dg/gcov/loop.C: Update test to support new format.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264112 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/gcov.texi
gcc/gcov.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gcov/loop.C

index ce7a3b1370071dc34fdaa52ad7a80f2d0aec303b..4011ba616af5f0d0a79b26f75c1120e47edc1fee 100644 (file)
@@ -1,3 +1,10 @@
+2018-09-05  Martin Liska  <mliska@suse.cz>
+
+       * 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  <mliska@suse.cz>
 
        PR target/87164
index f33dc8f6aed3137d5733a6cd5ef99f1e350cf242..98f4a876293fc36b2bdb1527cf965b48c25c9a80 100644 (file)
@@ -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
index ff4020c713e64be666c6e222806bb7a562093f56..6a24a3200469e73d5d84f6c982f5227213db87c1 100644 (file)
@@ -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;
 }
 
index 8b3578f38f20ca9c1a9148a39285dd45044fcde2..b4ee15292d1b0453be7b08addfda7626b0356aaa 100644 (file)
@@ -1,3 +1,7 @@
+2018-09-05  Martin Liska  <mliska@suse.cz>
+
+       * g++.dg/gcov/loop.C: Update test to support new format.
+
 2018-09-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR debug/86593
index 7f3be5587af964d1d71bb968a80bb33784abfa0d..24f580634d904cfe5b125fe91ef5b5a2b001c3e1 100644 (file)
@@ -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) */