From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, Liang Li <liang.z.li@intel.com>,
dgilbert@redhat.com
Subject: [Qemu-devel] [PULL 5/6] migration: reduce the count of strlen call
Date: Wed, 15 Jul 2015 12:29:36 +0200 [thread overview]
Message-ID: <1436956177-17440-6-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1436956177-17440-1-git-send-email-quintela@redhat.com>
From: Liang Li <liang.z.li@intel.com>
'strlen' is called three times in 'save_page_header', it's
inefficient.
Signed-off-by: Liang Li <liang.z.li@intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
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
next prev parent reply other threads:[~2015-07-15 10:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 10:29 [Qemu-devel] [PULL v2 0/6] Migration pull request Juan Quintela
2015-07-15 10:29 ` [Qemu-devel] [PULL 1/6] migration: Only change state after migration has finished Juan Quintela
2015-07-15 10:29 ` [Qemu-devel] [PULL 2/6] migration: Trace event and migration event are different things Juan Quintela
2015-07-15 10:29 ` [Qemu-devel] [PULL 3/6] migration: Write documetation for events capabilites Juan Quintela
2015-07-15 10:29 ` [Qemu-devel] [PULL 4/6] migration: Register global state section before loadvm Juan Quintela
2015-07-15 10:29 ` Juan Quintela [this message]
2015-07-15 10:29 ` [Qemu-devel] [PULL 6/6] migration: We also want to store the global state for savevm Juan Quintela
2015-07-15 13:18 ` [Qemu-devel] [PULL v2 0/6] Migration pull request Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2015-07-15 9:04 [Qemu-devel] [PULL " Juan Quintela
2015-07-15 9:04 ` [Qemu-devel] [PULL 5/6] migration: reduce the count of strlen call Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436956177-17440-6-git-send-email-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=amit.shah@redhat.com \
--cc=dgilbert@redhat.com \
--cc=liang.z.li@intel.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).