From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16534 invoked by alias); 24 Jun 2010 16:21:32 -0000 Received: (qmail 16514 invoked by uid 22791); 24 Jun 2010 16:21:30 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Jun 2010 16:21:25 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5OGL79Y001622 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Jun 2010 12:21:07 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5OGL6Pa017744; Thu, 24 Jun 2010 12:21:06 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o5OGL4uO020070; Thu, 24 Jun 2010 12:21:05 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 776763792DB; Thu, 24 Jun 2010 10:21:04 -0600 (MDT) From: Tom Tromey To: Paul Hilfinger Cc: gdb-patches@sourceware.org, brobecker@adacore.com, Paul Hilfinger Subject: Re: [RFA] Refactor 'maint time' command statistics. References: <1277281366-548-1-git-send-email-Hilfinger@adacore.com> Reply-To: tromey@redhat.com Date: Thu, 24 Jun 2010 16:21:00 -0000 In-Reply-To: <1277281366-548-1-git-send-email-Hilfinger@adacore.com> (Paul Hilfinger's message of "Wed, 23 Jun 2010 01:22:46 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-06/txt/msg00533.txt.bz2 >>>>> "Paul" == Paul Hilfinger writes: Paul> Refactor 'maint time' code and make it work for errors, too. Paul> Consolidate code for displaying per-command time and space Paul> statistics to avoid duplication. Piggyback on cleanups so that Paul> statistics get printed even when commands terminate as a result of Paul> an error. This looks pretty good. A couple nits... Paul> + printf_unfiltered (msg_type == 0 ? Paul> + _("Startup time: %ld.%06ld\n") : Paul> + _("Command execution time: %ld.%06ld\n"), In the GNU style the "?" and ":" should appear at the start of lines, not the end. Paul> + printf_unfiltered (msg_type == 0 ? Paul> + _("Space used: %ld (%c%ld during startup)\n") : Paul> + _("Space used: %ld (%c%ld for this command)\n"), Likewise. Paul> + struct cmd_stats *new_stat = XMALLOC (struct cmd_stats); [...] Paul> + return make_cleanup (report_command_stats, new_stat); It is more future-proof to use make_cleanup_dtor, so that the allocated closure is freed even if the cleanup is discarded. (Then I think you also need to remove the xfree from report_command_stats.) This is ok with those changes. thanks, Tom