Hi,

One of the possible explanation is that for remote unwinding, the library needs 
to remap the remote process's memory into the memory of the unwinder. Accessing 
memory of another process takes time.

Best regards

Frederic Berat

-----Original Message-----
Date: Sun, 10 Jul 2016 11:17:48 +0800 (CST)
From: ??? <[email protected]>
To: [email protected]
Subject: [Libunwind-devel] how to speedup remote unwinding?
Message-ID: <[email protected]>
Content-Type: text/plain; charset="gbk"



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