From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSnsq-0000FV-GR for qemu-devel@nongnu.org; Sat, 13 Sep 2014 10:01:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSnsc-0002EW-Mj for qemu-devel@nongnu.org; Sat, 13 Sep 2014 10:01:00 -0400 Received: from mail-yk0-x230.google.com ([2607:f8b0:4002:c07::230]:55477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSnsc-0002EJ-Fv for qemu-devel@nongnu.org; Sat, 13 Sep 2014 10:00:46 -0400 Received: by mail-yk0-f176.google.com with SMTP id 131so1097258ykp.7 for ; Sat, 13 Sep 2014 07:00:46 -0700 (PDT) From: Sanidhya Kashyap Date: Sat, 13 Sep 2014 10:00:14 -0400 Message-Id: <1410616814-27388-7-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1410616814-27388-1-git-send-email-sanidhya.iiith@gmail.com> References: <1410616814-27388-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [PATCH v6 6/6] BitmapLog: 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: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela I have modified the script to support the dump of the images to the file. Earlier, everything was saved to the memory and later the processing was taking place. Now, I have tried to solve that issue with only using the required memory. After discussion with David, I have tried to select a base 2 matrix dimension like 512 X 512 or 1024 X 512 etc for the dumping of the bitmap. But, I am still supporting the default square root based method of dimension selection. Signed-off-by: Sanidhya Kashyap --- scripts/extract-bitmap.py | 213 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 213 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..9a5a481 --- /dev/null +++ b/scripts/extract-bitmap.py @@ -0,0 +1,213 @@ +#!/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) 2014 Sanidhya Kashyap +# +# Authors: +# Sanidhya Kashyap +# +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. + +import struct +import argparse +from functools import partial +from math import sqrt +from numpy import array +from pylab import figure, imshow, savefig, gray, xlim, ylim +from os import path, makedirs + +long_bytes = 8 +byte_size = 8 +int_bytes = 4 +block_list = [] +total_blocks = 0 + +def get_unsigned_long_integer(value): + return struct.unpack('