public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/stats/
Date: Fri, 21 Feb 2014 17:36:54 +0000 (UTC)	[thread overview]
Message-ID: <1392931094.f6cd141477e64a7500366206f4cb098f3a249256.dywi@gentoo> (raw)

commit:     f6cd141477e64a7500366206f4cb098f3a249256
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Feb 20 21:18:14 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> 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 (...) ---


             reply	other threads:[~2014-02-21 17:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21 17:36 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-05 10:24 [gentoo-commits] proj/R_overlay:master commit in: roverlay/stats/ André Erdmann
2013-09-05  9:25 André Erdmann
2013-09-05  9:25 André Erdmann
2013-08-16 12:42 André Erdmann
2013-08-16 10:43 André Erdmann
2013-08-15  9:18 André Erdmann
2013-08-02 10:34 André Erdmann
2013-07-29 14:56 André Erdmann
2013-07-29  8:55 André Erdmann
2013-07-26 13:02 André Erdmann
2013-07-25 15:20 André Erdmann
2013-07-25 14:28 André Erdmann
2013-07-24 16:52 André Erdmann

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=1392931094.f6cd141477e64a7500366206f4cb098f3a249256.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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