HI~
 I'm using remote unwinding to get the call chain of a "remote" process, I 
found it a little slower than I expected。 It needs 0.04 seconds to do one 
backtrace, while using local unwinding, it just need 0.0002 seconds  to do one 
backtrace.
why remote unwinding is so much slower than local unwinding, is there any way 
to speed up the remote unwinding? actually the target process is in the same 
machine.
below is my code using libunwind. I will be appreciate for any suggestions.


static unw_addr_space_t as;
static struct UPT_info *ui;
void do_traceback()
{
    unw_cursor_t c;
    unw_word_t ip, sp;
    int ret;
    unw_init_remote(&c, as, ui);
    ret = unw_step(&c);
    while(ret > 0)
    {
        unw_get_reg(&c, UNW_REG_IP, &ip);
        unw_get_reg(&c, UNW_REG_SP, &sp);
        printf("ip = %lx, sp = %lx\n", (long) ip, (long) sp);
        ret = unw_step(&c);
    }
}
void main(int argc, char *argv[])
{
    as = unw_create_addr_space(&_UPT_accessors, 0);
    ui = _UPT_create(pid);
    attach_process(pid);
    do_traceback();
    detach_process(pid);
}




--

    致
礼!
 
杨光栋




 
_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to