[PATCH spice-streaming-agent 1/4] Add some information to the log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allows to track different frame timing.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 src/spice-streaming-agent.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 8b3f833..56c1582 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -386,6 +386,12 @@ static void cursor_changes(Display *display, int event_base)
     }
 }
 
+#define STAT_LOG(format, ...) do { \
+    if (f_log && !log_binary) { \
+        fprintf(f_log, "%" PRIu64 ": " format "\n", get_time(), ## __VA_ARGS__); \
+    } \
+} while(0)
+
 static void
 do_capture(const char *streamport, FILE *f_log)
 {
@@ -423,7 +429,9 @@ do_capture(const char *streamport, FILE *f_log)
             }
             uint64_t time_before = get_time();
 
+            STAT_LOG("Capturing...");
             FrameInfo frame = capture->CaptureFrame();
+            STAT_LOG("Captured");
 
             uint64_t time_after = get_time();
             syslog(LOG_DEBUG,
@@ -443,6 +451,7 @@ do_capture(const char *streamport, FILE *f_log)
                 codec = capture->VideoCodecType();
 
                 syslog(LOG_DEBUG, "wXh %uX%u  codec=%u\n", width, height, codec);
+                STAT_LOG("Started new stream wXh %uX%u  codec=%u", width, height, codec);
 
                 if (spice_stream_send_format(width, height, codec) == EXIT_FAILURE) {
                     throw std::runtime_error("FAILED to send format message");
@@ -461,6 +470,7 @@ do_capture(const char *streamport, FILE *f_log)
                 syslog(LOG_ERR, "FAILED to send a frame\n");
                 break;
             }
+            STAT_LOG("Sent");
             //usleep(1);
             if (read_command(false) < 0) {
                 syslog(LOG_ERR, "FAILED to read command\n");
@@ -496,6 +506,7 @@ int main(int argc, char* argv[])
         { "help", no_argument, NULL, 'h'},
         { 0, 0, 0, 0}
     };
+    std::vector<std::string> old_args(argv, argv+argc);
 
     openlog("spice-streaming-agent",
             isatty(fileno(stderr)) ? (LOG_PERROR|LOG_PID) : LOG_PID, LOG_USER);
@@ -554,7 +565,11 @@ int main(int argc, char* argv[])
                    log_filename, strerror(errno));
             return EXIT_FAILURE;
         }
+        for (const std::string& arg: old_args) {
+            STAT_LOG("Args: %s", arg.c_str());
+        }
     }
+    old_args.clear();
 
     Display *display = XOpenDisplay(NULL);
     if (display == NULL) {
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]