From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wmo9Q-0005O9-Rx for qemu-devel@nongnu.org; Tue, 20 May 2014 13:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wmo9L-0004xi-Fp for qemu-devel@nongnu.org; Tue, 20 May 2014 13:48:32 -0400 Received: from mail-pb0-x234.google.com ([2607:f8b0:400e:c01::234]:46768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wmo9L-0004xZ-7z for qemu-devel@nongnu.org; Tue, 20 May 2014 13:48:27 -0400 Received: by mail-pb0-f52.google.com with SMTP id rr13so532590pbb.25 for ; Tue, 20 May 2014 10:48:25 -0700 (PDT) From: Sanidhya Kashyap Date: Tue, 20 May 2014 23:17:55 +0530 Message-Id: <1400608075-19917-7-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1400608075-19917-1-git-send-email-sanidhya.iiith@gmail.com> References: <1400608075-19917-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [PATCH 6/6] python script for extracting bitmap from a binary file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Juan Quintela This script extracts the bitmap only from a binary file. It takes only a single input as file. This will be useful to users for exploring the writable working set for the VM. Signed-off-by: Sanidhya Kashyap --- scripts/extract-bitmap.py | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 scripts/extract-bitmap.py diff --git a/scripts/extract-bitmap.py b/scripts/extract-bitmap.py new file mode 100755 index 0000000..64ce136 --- /dev/null +++ b/scripts/extract-bitmap.py @@ -0,0 +1,68 @@ +#!/usr/bin/python +# This python script helps in extracting the dirty bitmap present +# in the file after executing the log-dirty-bitmap command either +# from the qmp or hmp interface. This file only processes binary +# file obtained via command. +# +# Copyright (C) Sanidhya Kashyap +# +# Authors: +# Sanidhya Kashyap +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, see . +# + +import struct +import argparse +from functools import partial + +long_bytes = 8 +complete_bitmap_list = [] + +def get_unsigned_long_integer(value): + return struct.unpack('