diff options
author | Yao Qi <yao@codesourcery.com> | 2013-10-24 09:28:33 +0800 |
---|---|---|
committer | Tom Tromey <tromey@sourceware.org> | 2013-10-25 14:03:01 +0000 |
commit | 6c177e28eafe09afcb4a9823d0addd568b202418 (patch) | |
tree | d7db153a55e72afa9741f937c868da413a8a70a0 | |
parent | 09c1234798f71dff06044650ea618f11c17b9263 (diff) | |
download | gdb-6c177e28eafe09afcb4a9823d0addd568b202418.zip gdb-6c177e28eafe09afcb4a9823d0addd568b202418.tar.gz gdb-6c177e28eafe09afcb4a9823d0addd568b202418.tar.bz2 |
Send qXfer:traceframe-info:read when traceframe is selected.
When I do 'si', I find many 'qXfer:traceframe-info:read' packets are sent,
which is not necessary. It slows down the single step.
(gdb) si
Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
Sending packet: $Z0,80483c7,1#b4...Packet received: OK
Sending packet: $Z0,4ce5b6b0,1#6e...Packet received: OK
Sending packet: $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;2c;4c;#5f...Packet received: OK
Sending packet: $vCont;s:p1b15.1b15;c#20...Packet received: T0505:44efffbf;04:44efffbf;08:d1830408;thread:p1b15.1b15;core:3;
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $mbfffef40,40#c0...Packet received: d183040878efffbf2e840408030000000000a040030000000500000070efffbf07000000010000004984040807000000030000000500000000000000b396e84c
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $z0,80483c7,1#d4...Packet received: OK
Sending packet: $z0,4ce5b6b0,1#8e...Packet received: OK
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
This problem was introduced by this patch
(https://sourceware.org/ml/gdb-patches/2013-04/msg00000.html), in
which get_traceframe_number is not checked before calling
traceframe_available_memory. This patch moves the check to
remote_traceframe_info, say, if GDB doesn't have traceframe selected, GDB
doesn't need to send qXfer:traceframe-info:read packets.
With this patch applied, there is no qXfer:traceframe-info:read sent
out and single step is speed up a little bit.
Here is the experiment I did:
Num of single step Original Patched
single-step cpu_time 10000 8.08 7.57
single-step cpu_time 20000 16.23 14.23
single-step cpu_time 30000 24.19 21.59
single-step cpu_time 40000 32.49 28.0
single-step wall_time 10000 14.1974210739 13.2641420364
single-step wall_time 20000 28.5278921127 25.0541369915
single-step wall_time 30000 42.5864038467 38.0038759708
single-step wall_time 40000 57.2107698917 49.2350611687
single-step vmsize 10000 16128 16388
single-step vmsize 20000 16128 16388
single-step vmsize 30000 16260 16520
single-step vmsize 40000 16444 16704
The patch is tested on x86_64-linux.
gdb:
2013-10-24 Yao Qi <yao@codesourcery.com>
* remote.c (remote_traceframe_info): Return early if
traceframe is not selected.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/remote.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d7c044b..ec491c5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-10-25 Yao Qi <yao@codesourcery.com> + * remote.c (remote_traceframe_info): Return early if + traceframe is not selected. + +2013-10-25 Yao Qi <yao@codesourcery.com> + * tracepoint.c (traceframe_fun): Remove. (traceframe_sal): Remove. (set_traceframe_context): Add local variables. diff --git a/gdb/remote.c b/gdb/remote.c index 7d8a4de..7bd9b2a 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -11157,6 +11157,11 @@ remote_traceframe_info (void) { char *text; + /* If current traceframe is not selected, don't bother the remote + stub. */ + if (get_traceframe_number () < 0) + return NULL; + text = target_read_stralloc (¤t_target, TARGET_OBJECT_TRACEFRAME_INFO, NULL); if (text != NULL) |