Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/2] Compute traceframe usuage per tracepoint on demand.
Date: Wed, 12 Dec 2012 01:38:00 -0000	[thread overview]
Message-ID: <1355276266-23163-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1355276266-23163-1-git-send-email-yao@codesourcery.com>

Hi,
This patch fixes this problem by computing the traceframe usage when
replying to packet 'qTP'.

gdb/gdbserver:

2012-12-11  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (cmd_qtp): Compute the traceframe usage of a
	tracepoint.
---
 gdb/gdbserver/tracepoint.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 1526838..ecc85ab 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -3674,6 +3674,8 @@ cmd_qtp (char *own_buf)
   ULONGEST num, addr;
   struct tracepoint *tpoint;
   char *packet = own_buf;
+  struct traceframe *tframe;
+  uint64_t traceframe_usage = 0;
 
   packet += strlen ("qTP:");
 
@@ -3692,8 +3694,16 @@ cmd_qtp (char *own_buf)
       return;
     }
 
+  /* Compute the traceframe usage of tracepoint whose number is
+     NUM.  */
+  for (tframe = FIRST_TRACEFRAME ();
+       tframe->tpnum != 0;
+       tframe = NEXT_TRACEFRAME (tframe))
+    if (tframe->tpnum == num)
+      traceframe_usage += tframe->data_size;
+
   sprintf (own_buf, "V%" PRIu64 ":%" PRIu64 "", tpoint->hit_count,
-	   tpoint->traceframe_usage);
+	   traceframe_usage);
 }
 
 /* State variables to help return all the tracepoint bits.  */
-- 
1.7.7.6


  reply	other threads:[~2012-12-12  1:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12  1:37 [RFC 0/2 gdbserver] Compute 'traceframe usage' per tracepoint Yao Qi
2012-12-12  1:38 ` Yao Qi [this message]
2012-12-17  9:21   ` [PATCH 2/2] Compute traceframe usuage per tracepoint on demand Yao Qi
2013-01-07 15:39     ` Pedro Alves
2013-01-07 15:56       ` Pedro Alves
2012-12-12  1:38 ` [PATCH 1/2] Test case: check traceframe_usage Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355276266-23163-3-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox