Greetings! I am trying to let qemu periodically print how many memory pages get dirtied since the last call. I added some code in qemu in the following way.
I first of all create a thread right before main_loop (vl.c). Below is what this this thread does: void* report_dirty_pages(void* arg) { memory_global_dirty_log_start(); // To turn on the KVM_MEM_LOG_DIRTY_PAGES flags for all the memory pages while(1) { memory_global_sync_dirty_bitmap(get_system_memory()); sleep(5); // Report every 5 minutes //TODO Question: how do I know how many pages get dirtied? } } I got two questions here. The first question is am I doing correct? If I am right, how do I know how many pages get dirtied so that I can print this number? Many thanks for your patience and time. -- Regards, Wang Cheng