From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31893 invoked by alias); 21 May 2012 20:43:56 -0000 Received: (qmail 31766 invoked by uid 22791); 21 May 2012 20:43:53 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ob0-f169.google.com (HELO mail-ob0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 May 2012 20:43:38 +0000 Received: by obbwd18 with SMTP id wd18so10955985obb.0 for ; Mon, 21 May 2012 13:43:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding:x-system-of-record :x-gm-message-state; bh=3GDCrzccZzgRuIuxiFZNFrQOxhzhEVTcC1Az2j4W1Ok=; b=IrV4hDWZCkaKDvIgm3Sl3N0+82RClqkH8c35SDDeTia/r98vXc0Wwa8Nscl04fi2rV hQPAMtghgJqWeaw3LK1Gzvljod5bXyBErmgFBDs1e8lFVSlT9gJv2OsbiLPmY8gsM5vD nu+DjNALXIVMsUg3uYXIPBbxrOhizol1ScV07Wxbnf9Ih/cKzwxKBE8zRzoNwE4CxMPX CxgBOsWjTM5YYToMh4dVQofTgsG3e1i86LaB/VsgKf8LT9wKDXb2z3kAFJsEImYth7Qx 0Mmwo7GbpMbuMJ8mh37P61l9aNYni9KZLH175nZTsKUr5lw8KJ9aAeVCcRtrQAPu5CQ4 SeMg== Received: by 10.182.141.9 with SMTP id rk9mr20536933obb.50.1337633018311; Mon, 21 May 2012 13:43:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.141.9 with SMTP id rk9mr20536925obb.50.1337633018205; Mon, 21 May 2012 13:43:38 -0700 (PDT) Received: by 10.60.9.66 with HTTP; Mon, 21 May 2012 13:43:38 -0700 (PDT) In-Reply-To: References: Date: Mon, 21 May 2012 20:43:00 -0000 Message-ID: Subject: Re: [PATCH] Remove time waiting for user from walltime in stats From: Aaron Gamble To: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQm/U95mzjCNYDdWXhfRaDUgpnfprnwEA8GQPVAEHJ7Z79+V+kQzC9BZgRPM/4Oct7Gs5AzUHOMA3mXRsa0xs5Lp5evg6K9ErvEqnZeBFub6od9OFWWohQdqbVZvo6hCfXJVabtCro4FelEqUdp+QZ9NsFaPLQ== X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00790.txt.bz2 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 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 =A0Aaron Gamble =A0 > > =A0 =A0 * gdb/utils.c: Added global static variable to track time spend > waiting for user in paging > > --- a/gdb/utils.c =A0 =A0 =A0 2012-05-11 12:21:33.000000000 -0700 > +++ b/gdb/utils.c =A0 =A0 =A0 2012-05-18 14:16:56.000000000 -0700 > @@ -104,6 +104,14 @@ > =A0static void set_screen_size (void); > =A0static void set_width (void); > > +/* Time spent in prompt_for_continue in the currently executing command > + =A0 waiting for user to respond. > + =A0 Initialized in make_command_stats_cleanup. > + =A0 Modified in prompt_for_continue. > + =A0 Used in report_command_stats. =A0*/ > + > +static struct timeval prompt_for_continue_wait_time; > + > =A0/* A flag indicating whether to timestamp debugging messages. =A0*/ > > =A0static int debug_timestamp =3D 0; > @@ -535,6 +543,10 @@ > =A0 =A0 =A0 timeval_sub (&delta_wall_time, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &now_wall_time, &start_stats->start_w= all_time); > > + =A0 =A0 =A0/* Subtract time spend in prompt_for_continue from walltime.= =A0*/ > + =A0 =A0 =A0timeval_sub (&delta_wall_time, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &delta_wall_time, &prompt_for_conti= nue_wait_time); > + > =A0 =A0 =A0 printf_unfiltered (msg_type =3D=3D 0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ? _("Startup time: %ld.%0= 6ld (cpu), %ld.%06ld (wall)\n") > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 : _("Command execution ti= me: %ld.%06ld (cpu), %ld.%06ld (wall)\n"), > @@ -568,6 +580,7 @@ > =A0struct cleanup * > =A0make_command_stats_cleanup (int msg_type) > =A0{ > + =A0static const struct timeval zero_timeval =3D { 0 }; > =A0 struct cmd_stats *new_stat =3D XMALLOC (struct cmd_stats); > > =A0#ifdef HAVE_SBRK > @@ -578,6 +591,9 @@ > =A0 new_stat->msg_type =3D msg_type; > =A0 new_stat->start_cpu_time =3D get_run_time (); > =A0 gettimeofday (&new_stat->start_wall_time, NULL); > + > + =A0/* Initalize timer to keep track of how long we waited for the user.= =A0*/ > + =A0prompt_for_continue_wait_time =3D zero_timeval; > > =A0 return make_cleanup_dtor (report_command_stats, new_stat, xfree); > =A0} > @@ -1795,6 +1811,11 @@ > =A0{ > =A0 char *ignore; > =A0 char cont_prompt[120]; > + =A0/* Used to add duration we waited for user to respond to > + =A0 =A0 prompt_for_continue_wait_time. =A0*/ > + =A0struct timeval prompt_started, prompt_ended, prompt_delta; > + > + =A0gettimeofday (&prompt_started, NULL); > > =A0 if (annotation_level > 1) > =A0 =A0 printf_unfiltered (("\n\032\032pre-prompt-for-continue\n")); > @@ -1821,6 +1842,12 @@ > =A0 =A0 =A0whereas control-C to gdb_readline will cause the user to get d= umped > =A0 =A0 =A0out to DOS. =A0*/ > =A0 ignore =3D gdb_readline_wrapper (cont_prompt); > + > + =A0/* Add time spend in this routine to prompt_for_continue_wait_time. = =A0*/ > + =A0gettimeofday (&prompt_ended, NULL); > + =A0timeval_sub (&prompt_delta, &prompt_ended, &prompt_started); > + =A0timeval_add (&prompt_for_continue_wait_time, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 &prompt_for_continue_wait_time, &prompt_del= ta); > > =A0 if (annotation_level > 1) > =A0 =A0 printf_unfiltered (("\n\032\032post-prompt-for-continue\n"));