Fill up {,un}compression stats for ZSTD in LTO.

Message ID 266d4b67-3979-b0aa-6937-0e839dcc7ca3@suse.cz
State New
Headers show
Series
  • Fill up {,un}compression stats for ZSTD in LTO.
Related show

Commit Message

Martin Liška May 20, 2020, 9:59 a.m.
Hi.

As Honza correctly noticed we're missing {,un}compression ratio for
ZSTD compression.

Before:

gcc foo.o -flto-report 2>&1 | grep com
[WPA] Compression: 1022 input bytes, 0 uncompressed bytes (ratio: 0.000000)
[WPA] Compression: 1368 input bytes, 0 uncompressed bytes (ratio: 0.000000)

After:

gcc foo.o -flto-report 2>&1 | grep com
[WPA] Compression: 1022 input bytes, 1647 uncompressed bytes (ratio: 1.611546)
[WPA] Compression: 1368 input bytes, 1953 uncompressed bytes (ratio: 1.427632)

Ready to be installed after regression tests?
Thanks,
Martin

gcc/ChangeLog:

2020-05-20  Martin Liska  <mliska@suse.cz>

	* lto-compress.c (lto_compression_zstd): Fill up
	num_compressed_il_bytes.
	(lto_uncompression_zstd): Likewise for num_uncompressed_il_bytes here.
---
  gcc/lto-compress.c | 2 ++
  1 file changed, 2 insertions(+)

Comments

Jan Hubicka May 20, 2020, 11:51 a.m. | #1
> Hi.

> 

> As Honza correctly noticed we're missing {,un}compression ratio for

> ZSTD compression.

> 

> Before:

> 

> gcc foo.o -flto-report 2>&1 | grep com

> [WPA] Compression: 1022 input bytes, 0 uncompressed bytes (ratio: 0.000000)

> [WPA] Compression: 1368 input bytes, 0 uncompressed bytes (ratio: 0.000000)

> 

> After:

> 

> gcc foo.o -flto-report 2>&1 | grep com

> [WPA] Compression: 1022 input bytes, 1647 uncompressed bytes (ratio: 1.611546)

> [WPA] Compression: 1368 input bytes, 1953 uncompressed bytes (ratio: 1.427632)

> 

> Ready to be installed after regression tests?

> Thanks,

> Martin

> 

> gcc/ChangeLog:

> 

> 2020-05-20  Martin Liska  <mliska@suse.cz>

> 

> 	* lto-compress.c (lto_compression_zstd): Fill up

> 	num_compressed_il_bytes.

> 	(lto_uncompression_zstd): Likewise for num_uncompressed_il_bytes here.


OK, thanks!
Honza

Patch

diff --git a/gcc/lto-compress.c b/gcc/lto-compress.c
index 56cd9626b19..d19338b396a 100644
--- a/gcc/lto-compress.c
+++ b/gcc/lto-compress.c
@@ -141,6 +141,7 @@  lto_compression_zstd (struct lto_compression_stream *stream)
   if (ZSTD_isError (csize))
     internal_error ("compressed stream: %s", ZSTD_getErrorName (csize));
 
+  lto_stats.num_compressed_il_bytes += csize;
   stream->callback (outbuf, csize, NULL);
 
   lto_destroy_compression_stream (stream);
@@ -169,6 +170,7 @@  lto_uncompression_zstd (struct lto_compression_stream *stream)
   if (ZSTD_isError (dsize))
     internal_error ("decompressed stream: %s", ZSTD_getErrorName (dsize));
 
+  lto_stats.num_uncompressed_il_bytes += dsize;
   stream->callback (outbuf, dsize, stream->opaque);
 
   lto_destroy_compression_stream (stream);