diff mbox

[PATCHv1,2/4] Timers: add command line option -timer-debug-log

Message ID 1382740234-21345-3-git-send-email-alex@alex.org.uk
State New
Headers show

Commit Message

Alex Bligh Oct. 25, 2013, 10:30 p.m. UTC
Add a command line option -timer-debug-log which takes the name
of a file to which periodic timer debugging information will be
written.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
---
 include/qemu/timer.h |    1 +
 qemu-options.hx      |   11 +++++++++++
 qemu-timer.c         |    1 +
 vl.c                 |    3 +++
 4 files changed, 16 insertions(+)
diff mbox

Patch

diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index d3ab5b0..1f7c5e4 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -75,6 +75,7 @@  struct QEMUTimer {
 };
 
 extern QEMUTimerListGroup main_loop_tlg;
+extern const char *timer_debug_log;
 
 /*
  * QEMUClockType
diff --git a/qemu-options.hx b/qemu-options.hx
index 5dc8b75..605c1b9 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3116,6 +3116,17 @@  STEXI
 prepend a timestamp to each log message.(default:on)
 ETEXI
 
+DEF("timer-debug-log", HAS_ARG, QEMU_OPTION_timer_debug_log,
+    "-timer-debug-log FILE\n"
+    "                write timer debug log to FILE (default: don't write)",
+    QEMU_ARCH_ALL)
+STEXI
+@item -timer-debug-log @var{file}
+@findex -timer-debug-log
+Write timer debug output periodically to file @var{file}. By default,
+no timer debug logging is written.
+ETEXI
+
 HXCOMM This is the last statement. Insert new options before this line!
 STEXI
 @end table
diff --git a/qemu-timer.c b/qemu-timer.c
index 0e358ac..84a8932 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -57,6 +57,7 @@  typedef struct QEMUClock {
 
 QEMUTimerListGroup main_loop_tlg;
 QEMUClock qemu_clocks[QEMU_CLOCK_MAX];
+const char *timer_debug_log;
 
 /* A QEMUTimerList is a list of timers attached to a clock. More
  * than one QEMUTimerList can be attached to each clock, for instance
diff --git a/vl.c b/vl.c
index b42ac67..4564207 100644
--- a/vl.c
+++ b/vl.c
@@ -3794,6 +3794,9 @@  int main(int argc, char **argv, char **envp)
                 }
                 configure_msg(opts);
                 break;
+            case QEMU_OPTION_timer_debug_log:
+                timer_debug_log = optarg;
+                break;
             default:
                 os_parse_cmd_args(popt->index, optarg);
             }