Patchwork [13/42] migration: add migrate_set_state tracepoint

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 22, 2013, 4:36 p.m.
Message ID <1361551008-12430-14-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/222686/
State New
Headers show

Comments

Paolo Bonzini - Feb. 22, 2013, 4:36 p.m.
From: Kazuya Saito <saito.kazuya@jp.fujitsu.com>

Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration.c  | 9 ++++++++-
 trace-events | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)
Orit Wasserman - Feb. 25, 2013, 8:35 a.m.
On 02/22/2013 06:36 PM, Paolo Bonzini wrote:
> From: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
> 
> Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  migration.c  | 9 ++++++++-
>  trace-events | 3 +++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/migration.c b/migration.c
> index 9a234c7..b091532 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -23,6 +23,7 @@
>  #include "migration/block.h"
>  #include "qemu/thread.h"
>  #include "qmp-commands.h"
> +#include "trace.h"
>  
>  //#define DEBUG_MIGRATION
>  
> @@ -282,6 +283,7 @@ void migrate_fd_error(MigrationState *s)
>  {
>      DPRINTF("setting error state\n");
>      s->state = MIG_STATE_ERROR;
> +    trace_migrate_set_state(MIG_STATE_ERROR);
>      migrate_fd_cleanup(s);
>  }
>  
> @@ -289,6 +291,7 @@ static void migrate_fd_completed(MigrationState *s)
>  {
>      DPRINTF("setting completed state\n");
>      s->state = MIG_STATE_COMPLETED;
> +    trace_migrate_set_state(MIG_STATE_COMPLETED);
>      migrate_fd_cleanup(s);
>  }
>  
> @@ -319,6 +322,7 @@ static void migrate_fd_cancel(MigrationState *s)
>      DPRINTF("cancelling migration\n");
>  
>      s->state = MIG_STATE_CANCELLED;
> +    trace_migrate_set_state(MIG_STATE_CANCELLED);
>      migrate_fd_cleanup(s);
>  }
>  
> @@ -377,8 +381,9 @@ static MigrationState *migrate_init(const MigrationParams *params)
>  
>      s->bandwidth_limit = bandwidth_limit;
>      s->state = MIG_STATE_SETUP;
> -    s->total_time = qemu_get_clock_ms(rt_clock);
> +    trace_migrate_set_state(MIG_STATE_SETUP);
>  
> +    s->total_time = qemu_get_clock_ms(rt_clock);
>      return s;
>  }
>  
> @@ -738,6 +743,8 @@ static const QEMUFileOps buffered_file_ops = {
>  void migrate_fd_connect(MigrationState *s)
>  {
>      s->state = MIG_STATE_ACTIVE;
> +    trace_migrate_set_state(MIG_STATE_ACTIVE);
> +
>      s->bytes_xfer = 0;
>      s->buffer = NULL;
>      s->buffer_size = 0;
> diff --git a/trace-events b/trace-events
> index a27ae43..2999c0e 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -1090,3 +1090,6 @@ css_io_interrupt(int cssid, int ssid, int schid, uint32_t intparm, uint8_t isc,
>  # hw/s390x/virtio-ccw.c
>  virtio_ccw_interpret_ccw(int cssid, int ssid, int schid, int cmd_code) "VIRTIO-CCW: %x.%x.%04x: interpret command %x"
>  virtio_ccw_new_device(int cssid, int ssid, int schid, int devno, const char *devno_mode) "VIRTIO-CCW: add subchannel %x.%x.%04x, devno %04x (%s)"
> +
> +# migration.c
> +migrate_set_state(int new_state) "new state %d"
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>

Patch

diff --git a/migration.c b/migration.c
index 9a234c7..b091532 100644
--- a/migration.c
+++ b/migration.c
@@ -23,6 +23,7 @@ 
 #include "migration/block.h"
 #include "qemu/thread.h"
 #include "qmp-commands.h"
+#include "trace.h"
 
 //#define DEBUG_MIGRATION
 
@@ -282,6 +283,7 @@  void migrate_fd_error(MigrationState *s)
 {
     DPRINTF("setting error state\n");
     s->state = MIG_STATE_ERROR;
+    trace_migrate_set_state(MIG_STATE_ERROR);
     migrate_fd_cleanup(s);
 }
 
@@ -289,6 +291,7 @@  static void migrate_fd_completed(MigrationState *s)
 {
     DPRINTF("setting completed state\n");
     s->state = MIG_STATE_COMPLETED;
+    trace_migrate_set_state(MIG_STATE_COMPLETED);
     migrate_fd_cleanup(s);
 }
 
@@ -319,6 +322,7 @@  static void migrate_fd_cancel(MigrationState *s)
     DPRINTF("cancelling migration\n");
 
     s->state = MIG_STATE_CANCELLED;
+    trace_migrate_set_state(MIG_STATE_CANCELLED);
     migrate_fd_cleanup(s);
 }
 
@@ -377,8 +381,9 @@  static MigrationState *migrate_init(const MigrationParams *params)
 
     s->bandwidth_limit = bandwidth_limit;
     s->state = MIG_STATE_SETUP;
-    s->total_time = qemu_get_clock_ms(rt_clock);
+    trace_migrate_set_state(MIG_STATE_SETUP);
 
+    s->total_time = qemu_get_clock_ms(rt_clock);
     return s;
 }
 
@@ -738,6 +743,8 @@  static const QEMUFileOps buffered_file_ops = {
 void migrate_fd_connect(MigrationState *s)
 {
     s->state = MIG_STATE_ACTIVE;
+    trace_migrate_set_state(MIG_STATE_ACTIVE);
+
     s->bytes_xfer = 0;
     s->buffer = NULL;
     s->buffer_size = 0;
diff --git a/trace-events b/trace-events
index a27ae43..2999c0e 100644
--- a/trace-events
+++ b/trace-events
@@ -1090,3 +1090,6 @@  css_io_interrupt(int cssid, int ssid, int schid, uint32_t intparm, uint8_t isc,
 # hw/s390x/virtio-ccw.c
 virtio_ccw_interpret_ccw(int cssid, int ssid, int schid, int cmd_code) "VIRTIO-CCW: %x.%x.%04x: interpret command %x"
 virtio_ccw_new_device(int cssid, int ssid, int schid, int devno, const char *devno_mode) "VIRTIO-CCW: add subchannel %x.%x.%04x, devno %04x (%s)"
+
+# migration.c
+migrate_set_state(int new_state) "new state %d"