Skip to contentSkip to conversation

Is it possible to retrieve pre-process information in QEMU?

Qemu-devel 陳韋任 2 participants 3 messages May 17, 2012 – May 22, 2012

lore
Share & tools
lore

陳韋任

author
#0 lore raw

Hi all,

I 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 ratio. Is there a way to do that?

Thanks.

Regards,
chenwj

Signature · 5 lines
Wei-Ren Chen (陳韋任)
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
#1 lore raw

Hi...

Quoted 5 lines · 陳韋任

Hi all,

 I 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 ratio. Is there a way to do that?

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.

Why not just monitor it inside the guest? using system tap for example?

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
author
#2 lore raw
Quoted 9 lines
Quoted 3 lines

 I 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 ratio. Is there a way to do that?

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.

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 = cpu_arm_handle_mmu_fault(env, addr, is_write, mmu_idx);
    if (unlikely(ret)) {
        page_fault++;   // page fault
    }
    env = saved_env;
}

---

IIUC, cpu_arm_handle_mmu_fault will lookup guest page table, return 1 if there
is a page fault, that's why I add a counter there. But this way I'll collect 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

Signature · 5 lines
Wei-Ren Chen (陳韋任)
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