[Spice-devel] [PATCH server 3/3] red_worker: improve stream stats readability and ease of parsing

Yonit Halperin yhalperi at redhat.com
Mon Jun 24 12:38:05 PDT 2013


also added start/end-bit-rate and avg-quality to the final stream stats.
---
 server/mjpeg_encoder.c |  1 -
 server/red_worker.c    | 22 +++++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
index 92aef27..04b244e 100644
--- a/server/mjpeg_encoder.c
+++ b/server/mjpeg_encoder.c
@@ -221,7 +221,6 @@ MJpegEncoder *mjpeg_encoder_new(int bit_rate_control, uint64_t starting_bit_rate
 
 void mjpeg_encoder_destroy(MJpegEncoder *encoder)
 {
-    spice_debug("avg-quality %.2f", (double)encoder->avg_quality / encoder->num_frames);
     jpeg_destroy_compress(&encoder->cinfo);
     free(encoder->row);
     free(encoder);
diff --git a/server/red_worker.c b/server/red_worker.c
index f047d29..5b9f387 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2633,26 +2633,34 @@ static void red_print_stream_stats(DisplayChannelClient *dcc, StreamAgent *agent
 #ifdef STREAM_STATS
     StreamStats *stats = &agent->stats;
     double passed_mm_time = (stats->end - stats->start) / 1000.0;
+    MJpegEncoderStats encoder_stats = {0};
 
-    spice_debug("stream %ld (%dx%d): #frames-in %lu, #in-avg-fps %.2f, #frames-sent %lu, "
-                "#drops %lu (pipe %lu, fps %lu), avg_fps %.2f, "
-                "ratio(#frames-out/#frames-in) %.2f, "
-                "passed-mm-time %.2f (sec), size-total %.2f (MB), size-per-sec %.2f (Mbps), "
-                "size-per-frame %.2f (KBpf)",
+    if (agent->mjpeg_encoder) {
+        mjpeg_encoder_get_stats(agent->mjpeg_encoder, &encoder_stats);
+    }
+
+    spice_debug("stream=%ld dim=(%dx%d) #in-frames=%lu #in-avg-fps=%.2f #out-frames=%lu "
+                "out/in=%.2f #drops=%lu (#pipe=%lu #fps=%lu) out-avg-fps=%.2f "
+                "passed-mm-time(sec)=%.2f size-total(MB)=%.2f size-per-sec(Mbps)=%.2f "
+                "size-per-frame(KBpf)=%.2f avg-quality=%.2f "
+                "start-bit-rate(Mbps)=%.2f end-bit-rate(Mbps)=%.2f",
                 agent - dcc->stream_agents, agent->stream->width, agent->stream->height,
                 stats->num_input_frames,
                 stats->num_input_frames / passed_mm_time,
                 stats->num_frames_sent,
+                (stats->num_frames_sent + 0.0) / stats->num_input_frames,
                 stats->num_drops_pipe +
                 stats->num_drops_fps,
                 stats->num_drops_pipe,
                 stats->num_drops_fps,
                 stats->num_frames_sent / passed_mm_time,
-                (stats->num_frames_sent + 0.0) / stats->num_input_frames,
                 passed_mm_time,
                 stats->size_sent / 1024.0 / 1024.0,
                 ((stats->size_sent * 8.0) / (1024.0 * 1024)) / passed_mm_time,
-                stats->size_sent / 1000.0 / stats->num_frames_sent);
+                stats->size_sent / 1000.0 / stats->num_frames_sent,
+                encoder_stats.avg_quality,
+                encoder_stats.starting_bit_rate / (1024.0 * 1024),
+                encoder_stats.cur_bit_rate / (1024.0 * 1024));
 #endif
 }
 
-- 
1.8.1.4



More information about the Spice-devel mailing list