Example #1
0
 def print(cls):
     if not cls.stats:
         return
     ttl = cls.ttl_time
     print("[STATS] sampled SQL time: {}s".format(int(ttl / 1000)))
     for arr in sorted(cls.stats.items(), key=lambda x: -x[1][0])[0:40]:
         sql, vals = arr
         ms, calls = vals
         print("% 5.1f%% % 7dms % 9.2favg % 8dx -- %s"
               % (100 * ms/ttl, ms, ms/calls, calls, sql[0:180]))
     print("[STATS] peak memory usage: %.2fMB" % peak_usage_mb())
     cls.clear()
Example #2
0
 def report(cls):
     """Emit a timing report for tracked services."""
     if not cls._secs:
         return  # nothing to report
     total = perf() - cls._start
     non_idle = total - cls._idle
     log.info("cumtime %ds (%.1f%% of %ds). %.1f%% idle. peak %dmb.",
              cls._secs, 100 * cls._secs / non_idle, non_idle,
              100 * cls._idle / total, peak_usage_mb())
     if cls._secs > 1:
         cls._db.report(cls._secs)
         cls._steemd.report(cls._secs)
Example #3
0
 def report(cls):
     """Emit a timing report for tracked services."""
     if not cls._ms:
         return  # nothing to report
     local = cls._ms / 1000
     idle = cls._idle / 1000
     total = (perf() - cls._start)
     non_idle = total - idle
     log.info("cumtime %ds (%.1f%% of %ds). %.1f%% idle. peak %dmb.", local,
              100 * local / non_idle, non_idle, 100 * idle / total,
              peak_usage_mb())
     cls._db.report(cls._ms)
     cls._steemd.report(cls._ms)
Example #4
0
 def print(cls):
     if not cls.stats:
         return
     ttl = cls.ttltime
     print("[STATS] sampled steem time: {}s".format(int(ttl / 1000)))
     for arr in sorted(cls.stats.items(), key=lambda x: -x[1][0])[0:40]:
         sql, vals = arr
         ms, calls = vals
         print("% 5.1f%% % 9sms % 7.2favg % 8dx -- %s" %
               (100 * ms / ttl, "{:,}".format(
                   int(ms)), ms / calls, calls, sql[0:180]))
     print("[STATS] fastest steem call was %.3fms" % cls.fastest)
     print("[STATS] peak memory usage: %.2fMB" % peak_usage_mb())
     cls.clear()
Example #5
0
def test_peak_usage_mb():
    assert peak_usage_mb() > 1