[Spice-devel] [PATCH spice-streaming-agent 3/4] Always log statistics

Frediano Ziglio fziglio at redhat.com
Mon Apr 23 15:07:43 UTC 2018


Allow to see frame size even if frame data is disabled.
Useful to compute frame statistics not spending huge amount of space
for frame data.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/spice-streaming-agent.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 419ff3b..503c3b5 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -387,7 +387,7 @@ static void cursor_changes(Display *display, int event_base)
 }
 
 #define STAT_LOG(format, ...) do { \
-    if (f_log && !log_binary) { \
+    if (f_log) { \
         fprintf(f_log, "%" PRIu64 ": " format "\n", get_time(), ## __VA_ARGS__); \
     } \
 } while(0)
@@ -457,12 +457,11 @@ do_capture(const char *streamport, FILE *f_log)
                     throw std::runtime_error("FAILED to send format message");
                 }
             }
+            STAT_LOG("Frame of %zu bytes:", frame.buffer_size);
             if (f_log) {
                 if (log_binary) {
                     fwrite(frame.buffer, frame.buffer_size, 1, f_log);
                 } else {
-                    fprintf(f_log, "%" PRIu64 ": Frame of %zu bytes:\n",
-                            get_time(), frame.buffer_size);
                     hexdump(frame.buffer, frame.buffer_size, f_log);
                 }
             }
-- 
2.14.3



More information about the Spice-devel mailing list