From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWezl-0003Zq-W8 for qemu-devel@nongnu.org; Mon, 21 May 2012 22:38:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWezk-0004w3-37 for qemu-devel@nongnu.org; Mon, 21 May 2012 22:38:45 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:15087) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWezi-0004uf-5r for qemu-devel@nongnu.org; Mon, 21 May 2012 22:38:44 -0400 Date: Tue, 22 May 2012 10:38:33 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7?= Message-ID: <20120522023833.GA90903@cs.nctu.edu.tw> References: <20120517030936.GA13962@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Is it possible to retrieve pre-process information in QEMU? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mulyadi Santosa Cc: qemu-devel@nongnu.org, =?utf-8?B?6Zmz6Z+L5Lu7?= > > =C2=A0I would like to know if I can retrieve pre-process information = in QEMU > > system mode. For example, I want to know each process's page fault ra= tio. > > Is there a way to do that? >=20 > logically, it's possible, but you need to locate the task_struct of > each processes first. Using GDB, that might be a bit easier but still > not easy. >=20 > Why not just monitor it inside the guest? using system tap for example? O.K., what I did is something like below, --- void tlb_fill(CPUARMState *env1, target_ulong addr, int is_write, int mmu= _idx, uintptr_t retaddr) { ret =3D cpu_arm_handle_mmu_fault(env, addr, is_write, mmu_idx); if (unlikely(ret)) { page_fault++; // page fault } env =3D saved_env; } --- IIUC, cpu_arm_handle_mmu_fault will lookup guest page table, return 1 i= f there is a page fault, that's why I add a counter there. But this way I'll coll= ect a global static not per-process one. I'll try systemtap latter but not sure= it does the same thing I want to do. Any thoughts? :) Regards, chenwj --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj