From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id ABF6E138E20 for ; Fri, 21 Feb 2014 17:37:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A9AF5E0F06; Fri, 21 Feb 2014 17:36:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3EF93E0F06 for ; Fri, 21 Feb 2014 17:36:57 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3A3A933FA95 for ; Fri, 21 Feb 2014 17:36:56 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id E34EC18874 for ; Fri, 21 Feb 2014 17:36:54 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1392931094.f6cd141477e64a7500366206f4cb098f3a249256.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/stats/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/stats/abstract.py X-VCS-Directories: roverlay/stats/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: f6cd141477e64a7500366206f4cb098f3a249256 X-VCS-Branch: master Date: Fri, 21 Feb 2014 17:36:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 22a02a23-6c1c-46fe-a245-27c04b480e5a X-Archives-Hash: 3b4a6ee2108eeb3a86fb73bcf8058ebb commit: f6cd141477e64a7500366206f4cb098f3a249256 Author: André Erdmann mailerd de> AuthorDate: Thu Feb 20 21:18:14 2014 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Feb 20 21:18:14 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f6cd1414 roverlay/stats, timestats: add reset() method Fixes a bug when using the remote console ("./bin/debug/console remote") where the second query_packages command fails due to reset() missing for timestats objects. --- roverlay/stats/abstract.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/roverlay/stats/abstract.py b/roverlay/stats/abstract.py index 5ac87bc..c2ecace 100644 --- a/roverlay/stats/abstract.py +++ b/roverlay/stats/abstract.py @@ -120,16 +120,26 @@ class TimeStatsItem ( RoverlayStatsBase ): # doc TODO: note somewhere that those timestats are just approximate # values - def __init__ ( self, t_begin=None, t_end=None, description=None ): - super ( TimeStatsItem, self ).__init__ ( description=description ) + def _setup_time_stats_item ( self, t_begin, t_end ): self.time_begin = t_begin if t_begin is not None else time.time() self.time_end = t_end + # --- end of _setup_time_stats_item (...) --- + + def __init__ ( self, t_begin=None, t_end=None, description=None ): + super ( TimeStatsItem, self ).__init__ ( description=description ) + self.time_begin = None + self.time_end = None + self._setup_time_stats_item ( t_begin, t_end ) # --- end of __init__ (...) --- def end ( self, t_end=None ): self.time_end = time.time() if t_end is None else t_end # --- end of end (...) --- + def reset ( self ): + self._setup_time_stats_item ( None, None ) + # --- end of reset (...) --- + def get_delta ( self ): if self.time_begin is None: return -1.0 @@ -153,6 +163,11 @@ class TimeStats ( RoverlayStats ): self._timestats = collections.OrderedDict() # --- end of __init__ (...) --- + def reset ( self ): + for tstat in self._timestats.values(): + tstat.reset() + # --- end of reset (...) --- + def has_changes ( self ): return False # --- end of has_changes (...) ---