Bug 79246 - Make failed when uncommented COMPRESS_STAT in red_worker.c
Summary: Make failed when uncommented COMPRESS_STAT in red_worker.c
Status: RESOLVED FIXED
Alias: None
Product: Spice
Classification: Unclassified
Component: server (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: Spice Bug List
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-26 06:47 UTC by Qiang Wang
Modified: 2014-05-26 16:56 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Qiang Wang 2014-05-26 06:47:17 UTC
As a developer, I maybe want to see the detail compress stat of spice, like this:
Method   	  count  	orig_size(MB)	enc_size(MB)	enc_time(s)
QUIC     	     846	       948.02	      147.22	        7.51
GLZ      	    2895	       594.90	       26.60	        1.33
ZLIB GLZ 	       0	         0.00	        0.00	        0.00
LZ       	       1	         3.15	        0.01	        0.00
JPEG     	       0	         0.00	        0.00	        0.00
JPEG-RGBA	       0	         0.00	        0.00	        0.00
----------------------------------------------------------------------------
Total    	    3742	      1546.07	      173.83	        8.84

But when I uncommented the COMPRESS_STAT and COMPRESS_DEBUG in red_worker.c, I got this error.

~/git/spice.last/server$ make
make  all-recursive
make[1]: Entering directory `/home/qiang/git/spice.last/server'
Making all in .
make[2]: Entering directory `/home/qiang/git/spice.last/server'
  CC       red_worker.lo
red_worker.c:260:1: error: 'inline' is not at beginning of declaration [-Werror=old-style-declaration]
 double inline stat_byte_to_mega(uint64_t size)
 ^
In file included from ../spice-common/common/rect.h:24:0,
                 from red_worker.c:55:
red_worker.c: In function 'print_compress_stats':
red_worker.c:1155:79: error: 'CommonChannel' has no member named 'id'
     spice_info("==> Compression stats for display %u", display_channel->common.id);
                                                                               ^
../spice-common/common/log.h:90:94: note: in definition of macro 'spice_info'
     spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_INFO, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \
                                                                                              ^
cc1: all warnings being treated as errors
make[2]: *** [red_worker.lo] Error 1
make[2]: Leaving directory `/home/qiang/git/spice.last/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/qiang/git/spice.last/server'
make: *** [all] Error 2
Comment 1 Qiang Wang 2014-05-26 07:12:57 UTC
This error because of some simple syntax errors.
So a add this patch

Signed-off-by: Wang Qiang <wangqiang.hunan@gmail.com>
---
 server/red_worker.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 1871e13..6e4ba54 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -257,7 +257,7 @@ static inline void stat_compress_add(stat_info_t *info, stat_time_t start, int o
     info->comp_size += comp_size;
 }

-double inline stat_byte_to_mega(uint64_t size)
+static inline double stat_byte_to_mega(uint64_t size)
 {
     return (double)size / (1000 * 1000);
 }
@@ -1152,7 +1152,7 @@ static void print_compress_stats(DisplayChannel *display_channel)
                        display_channel->zlib_glz_stat.comp_size :
                        display_channel->glz_stat.comp_size;

-    spice_info("==> Compression stats for display %u", display_channel->common.id);
+    spice_info("==> Compression stats for display %u", display_channel->common.base.id);
     spice_info("Method   \t  count  \torig_size(MB)\tenc_size(MB)\tenc_time(s)");
     spice_info("QUIC     \t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->quic_stat.count,
-- 
1.9.1
Comment 2 Christophe Fergeau 2014-05-26 16:56:40 UTC
Thanks for the patch, pushed to git master:
http://cgit.freedesktop.org/spice/spice/commit/?id=e7db94d833e848b63fdd9956ba51ce2c5917cb25


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.