From: Aaron Gamble <agamble@google.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] Remove time waiting for user from walltime in stats
Date: Mon, 21 May 2012 20:43:00 -0000 [thread overview]
Message-ID: <CAHX8C+J+R3mhDk7Gk_S_e6DOEdbWTXbhvP61cQdRLQokda2wYg@mail.gmail.com> (raw)
In-Reply-To: <CAHX8C+J+Vmw25kngh=uBoa+OvBAPxE0v0BKKvZnD6Qu_CnypTw@mail.gmail.com>
Oops. Corrected ChangeLog entry:
* utils.c (prompt_for_continue_wait_time): New static global.
(make_command_stats_cleanup): Initialize it.
(report_command_stats): Subtract time waiting for user.
(prompt_for_continue): Track time waiting for user.
-Aaron
On Mon, May 21, 2012 at 1:21 PM, Aaron Gamble <agamble@google.com> wrote:
> Hi,
>
> Here is a patch to remove the time a gdb is waiting for a user to
> respond to paging from gdb's internal statistics. Currently if a user
> is reading paged output and waits 10 seconds to read/respond, those 10
> seconds are added to the walltime for the command issued.
>
> Time spent waiting for the user is stored in a global static variable
> in utils.c and is subtracted from the wall time when the stats are
> printed.
>
> 2012-05-21 Aaron Gamble <agamble@google.com>
>
> * gdb/utils.c: Added global static variable to track time spend
> waiting for user in paging
>
> --- a/gdb/utils.c 2012-05-11 12:21:33.000000000 -0700
> +++ b/gdb/utils.c 2012-05-18 14:16:56.000000000 -0700
> @@ -104,6 +104,14 @@
> static void set_screen_size (void);
> static void set_width (void);
>
> +/* Time spent in prompt_for_continue in the currently executing command
> + waiting for user to respond.
> + Initialized in make_command_stats_cleanup.
> + Modified in prompt_for_continue.
> + Used in report_command_stats. */
> +
> +static struct timeval prompt_for_continue_wait_time;
> +
> /* A flag indicating whether to timestamp debugging messages. */
>
> static int debug_timestamp = 0;
> @@ -535,6 +543,10 @@
> timeval_sub (&delta_wall_time,
> &now_wall_time, &start_stats->start_wall_time);
>
> + /* Subtract time spend in prompt_for_continue from walltime. */
> + timeval_sub (&delta_wall_time,
> + &delta_wall_time, &prompt_for_continue_wait_time);
> +
> printf_unfiltered (msg_type == 0
> ? _("Startup time: %ld.%06ld (cpu), %ld.%06ld (wall)\n")
> : _("Command execution time: %ld.%06ld (cpu), %ld.%06ld (wall)\n"),
> @@ -568,6 +580,7 @@
> struct cleanup *
> make_command_stats_cleanup (int msg_type)
> {
> + static const struct timeval zero_timeval = { 0 };
> struct cmd_stats *new_stat = XMALLOC (struct cmd_stats);
>
> #ifdef HAVE_SBRK
> @@ -578,6 +591,9 @@
> new_stat->msg_type = msg_type;
> new_stat->start_cpu_time = get_run_time ();
> gettimeofday (&new_stat->start_wall_time, NULL);
> +
> + /* Initalize timer to keep track of how long we waited for the user. */
> + prompt_for_continue_wait_time = zero_timeval;
>
> return make_cleanup_dtor (report_command_stats, new_stat, xfree);
> }
> @@ -1795,6 +1811,11 @@
> {
> char *ignore;
> char cont_prompt[120];
> + /* Used to add duration we waited for user to respond to
> + prompt_for_continue_wait_time. */
> + struct timeval prompt_started, prompt_ended, prompt_delta;
> +
> + gettimeofday (&prompt_started, NULL);
>
> if (annotation_level > 1)
> printf_unfiltered (("\n\032\032pre-prompt-for-continue\n"));
> @@ -1821,6 +1842,12 @@
> whereas control-C to gdb_readline will cause the user to get dumped
> out to DOS. */
> ignore = gdb_readline_wrapper (cont_prompt);
> +
> + /* Add time spend in this routine to prompt_for_continue_wait_time. */
> + gettimeofday (&prompt_ended, NULL);
> + timeval_sub (&prompt_delta, &prompt_ended, &prompt_started);
> + timeval_add (&prompt_for_continue_wait_time,
> + &prompt_for_continue_wait_time, &prompt_delta);
>
> if (annotation_level > 1)
> printf_unfiltered (("\n\032\032post-prompt-for-continue\n"));
next prev parent reply other threads:[~2012-05-21 20:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAHX8C++LmtfTqjOvargL3O1WiwL9+RP=3uXqQB0gutSGd+49sA@mail.gmail.com>
2012-05-21 20:22 ` Aaron Gamble
2012-05-21 20:43 ` Aaron Gamble [this message]
2012-05-21 21:01 ` Doug Evans
2012-05-22 20:50 ` Aaron Gamble
2012-05-24 17:02 ` Tom Tromey
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=CAHX8C+J+R3mhDk7Gk_S_e6DOEdbWTXbhvP61cQdRLQokda2wYg@mail.gmail.com \
--to=agamble@google.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