[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 5/6] migration: reduce the count of strlen call
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 5/6] migration: reduce the count of strlen call |
Date: |
Wed, 15 Jul 2015 12:29:36 +0200 |
From: Liang Li <address@hidden>
'strlen' is called three times in 'save_page_header', it's
inefficient.
Signed-off-by: Liang Li <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Amit Shah <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
migration/ram.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 1e58cd3..7f007e6 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -382,16 +382,16 @@ void migrate_compress_threads_create(void)
*/
static size_t save_page_header(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
{
- size_t size;
+ size_t size, len;
qemu_put_be64(f, offset);
size = 8;
if (!(offset & RAM_SAVE_FLAG_CONTINUE)) {
- qemu_put_byte(f, strlen(block->idstr));
- qemu_put_buffer(f, (uint8_t *)block->idstr,
- strlen(block->idstr));
- size += 1 + strlen(block->idstr);
+ len = strlen(block->idstr);
+ qemu_put_byte(f, len);
+ qemu_put_buffer(f, (uint8_t *)block->idstr, len);
+ size += 1 + len;
}
return size;
}
--
2.4.3
- [Qemu-devel] [PULL v2 0/6] Migration pull request, Juan Quintela, 2015/07/15
- [Qemu-devel] [PULL 4/6] migration: Register global state section before loadvm, Juan Quintela, 2015/07/15
- [Qemu-devel] [PULL 1/6] migration: Only change state after migration has finished, Juan Quintela, 2015/07/15
- [Qemu-devel] [PULL 3/6] migration: Write documetation for events capabilites, Juan Quintela, 2015/07/15
- [Qemu-devel] [PULL 6/6] migration: We also want to store the global state for savevm, Juan Quintela, 2015/07/15
- [Qemu-devel] [PULL 2/6] migration: Trace event and migration event are different things, Juan Quintela, 2015/07/15
- [Qemu-devel] [PULL 5/6] migration: reduce the count of strlen call,
Juan Quintela <=
- Re: [Qemu-devel] [PULL v2 0/6] Migration pull request, Peter Maydell, 2015/07/15