diff mbox

[07/13] Add tracepoints for savevm section start/end

Message ID af5d36a38dfb6bb75cc7c9d2b1e5ce5679855654.1340987905.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela June 29, 2012, 4:43 p.m. UTC
This allows to know how long each section takes to save.

An awk script like this tells us sections that takes more that 10ms

$1 ~ /savevm_state_iterate_end/ {
	/* Print savevm_section_end line when > 10ms duration */
	if ($2 > 10000) {
		printf("%s times_missing=%u\n", $0, times_missing++);
	}
}

Signed-off-by: Juan Quintela <quintela@redhat.com>

fix ws tracepoints

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 savevm.c     |    8 ++++++++
 trace-events |    5 +++++
 2 files changed, 13 insertions(+)

Comments

Blue Swirl June 29, 2012, 8:32 p.m. UTC | #1
On Fri, Jun 29, 2012 at 4:43 PM, Juan Quintela <quintela@redhat.com> wrote:
> This allows to know how long each section takes to save.
>
> An awk script like this tells us sections that takes more that 10ms
>
> $1 ~ /savevm_state_iterate_end/ {
>        /* Print savevm_section_end line when > 10ms duration */
>        if ($2 > 10000) {
>                printf("%s times_missing=%u\n", $0, times_missing++);
>        }
> }
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
--- missing

>
> fix ws tracepoints
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>

duplicate

> ---
>  savevm.c     |    8 ++++++++
>  trace-events |    5 +++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/savevm.c b/savevm.c
> index d1d9020..987c6c0 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -85,6 +85,7 @@
>  #include "cpus.h"
>  #include "memory.h"
>  #include "qmp-commands.h"
> +#include "trace.h"
>
>  #define SELF_ANNOUNCE_ROUNDS 5
>
> @@ -1625,11 +1626,14 @@ int qemu_savevm_state_iterate(QEMUFile *f)
>         if (se->save_live_state == NULL)
>             continue;
>
> +        trace_savevm_section_start();
>         /* Section type */
>         qemu_put_byte(f, QEMU_VM_SECTION_PART);
>         qemu_put_be32(f, se->section_id);
>
>         ret = se->save_live_state(f, QEMU_VM_SECTION_PART, se->opaque);
> +        trace_savevm_section_end(se->section_id);
> +
>         if (ret <= 0) {
>             /* Do not proceed to the next vmstate before this one reported
>                completion of the current stage. This serializes the migration
> @@ -1659,11 +1663,13 @@ int qemu_savevm_state_complete(QEMUFile *f)
>         if (se->save_live_state == NULL)
>             continue;
>
> +        trace_savevm_section_start();
>         /* Section type */
>         qemu_put_byte(f, QEMU_VM_SECTION_END);
>         qemu_put_be32(f, se->section_id);
>
>         ret = se->save_live_state(f, QEMU_VM_SECTION_END, se->opaque);
> +        trace_savevm_section_end(se->section_id);
>         if (ret < 0) {
>             return ret;
>         }
> @@ -1675,6 +1681,7 @@ int qemu_savevm_state_complete(QEMUFile *f)
>        if (se->save_state == NULL && se->vmsd == NULL)
>            continue;
>
> +        trace_savevm_section_start();
>         /* Section type */
>         qemu_put_byte(f, QEMU_VM_SECTION_FULL);
>         qemu_put_be32(f, se->section_id);
> @@ -1688,6 +1695,7 @@ int qemu_savevm_state_complete(QEMUFile *f)
>         qemu_put_be32(f, se->version_id);
>
>         vmstate_save(f, se);
> +        trace_savevm_section_end(se->section_id);
>     }
>
>     qemu_put_byte(f, QEMU_VM_EOF);
> diff --git a/trace-events b/trace-events
> index c935ba2..d671118 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -783,6 +783,11 @@ displaysurface_resize(void *display_state, void *display_surface, int width, int
>  # vga.c
>  ppm_save(const char *filename, void *display_surface) "%s surface=%p"
>
> +# savevm.c
> +
> +savevm_section_start(void) ""
> +savevm_section_end(unsigned int section_id) "section_id %u"
> +
>  # hw/qxl.c
>  disable qxl_interface_set_mm_time(int qid, uint32_t mm_time) "%d %d"
>  disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u"
> --
> 1.7.10.4
>
>
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index d1d9020..987c6c0 100644
--- a/savevm.c
+++ b/savevm.c
@@ -85,6 +85,7 @@ 
 #include "cpus.h"
 #include "memory.h"
 #include "qmp-commands.h"
+#include "trace.h"

 #define SELF_ANNOUNCE_ROUNDS 5

@@ -1625,11 +1626,14 @@  int qemu_savevm_state_iterate(QEMUFile *f)
         if (se->save_live_state == NULL)
             continue;

+        trace_savevm_section_start();
         /* Section type */
         qemu_put_byte(f, QEMU_VM_SECTION_PART);
         qemu_put_be32(f, se->section_id);

         ret = se->save_live_state(f, QEMU_VM_SECTION_PART, se->opaque);
+        trace_savevm_section_end(se->section_id);
+
         if (ret <= 0) {
             /* Do not proceed to the next vmstate before this one reported
                completion of the current stage. This serializes the migration
@@ -1659,11 +1663,13 @@  int qemu_savevm_state_complete(QEMUFile *f)
         if (se->save_live_state == NULL)
             continue;

+        trace_savevm_section_start();
         /* Section type */
         qemu_put_byte(f, QEMU_VM_SECTION_END);
         qemu_put_be32(f, se->section_id);

         ret = se->save_live_state(f, QEMU_VM_SECTION_END, se->opaque);
+        trace_savevm_section_end(se->section_id);
         if (ret < 0) {
             return ret;
         }
@@ -1675,6 +1681,7 @@  int qemu_savevm_state_complete(QEMUFile *f)
 	if (se->save_state == NULL && se->vmsd == NULL)
 	    continue;

+        trace_savevm_section_start();
         /* Section type */
         qemu_put_byte(f, QEMU_VM_SECTION_FULL);
         qemu_put_be32(f, se->section_id);
@@ -1688,6 +1695,7 @@  int qemu_savevm_state_complete(QEMUFile *f)
         qemu_put_be32(f, se->version_id);

         vmstate_save(f, se);
+        trace_savevm_section_end(se->section_id);
     }

     qemu_put_byte(f, QEMU_VM_EOF);
diff --git a/trace-events b/trace-events
index c935ba2..d671118 100644
--- a/trace-events
+++ b/trace-events
@@ -783,6 +783,11 @@  displaysurface_resize(void *display_state, void *display_surface, int width, int
 # vga.c
 ppm_save(const char *filename, void *display_surface) "%s surface=%p"

+# savevm.c
+
+savevm_section_start(void) ""
+savevm_section_end(unsigned int section_id) "section_id %u"
+
 # hw/qxl.c
 disable qxl_interface_set_mm_time(int qid, uint32_t mm_time) "%d %d"
 disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u"