mirror of
https://github.com/KevinMidboe/mktxp-no-cli.git
synced 2025-10-29 17:50:23 +00:00
firewall/mktxp colllectors, fixes/optimizations
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
import os, sys, shlex, tempfile, shutil, re
|
||||
import subprocess, hashlib
|
||||
from timeit import default_timer
|
||||
from collections.abc import Iterable
|
||||
from contextlib import contextmanager
|
||||
from multiprocessing import Process, Event
|
||||
@@ -35,6 +36,15 @@ def temp_dir(quiet = True):
|
||||
if not quiet:
|
||||
print ('Error while removing a tmp dir: {}'.format(e.args[0]))
|
||||
|
||||
class Benchmark:
|
||||
def __enter__(self):
|
||||
self.start = default_timer()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.time = default_timer() - self.start
|
||||
|
||||
|
||||
class CmdProcessingError(Exception):
|
||||
pass
|
||||
|
||||
@@ -253,5 +263,3 @@ class RepeatableTimer:
|
||||
break
|
||||
self.finished.wait(self.interval)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user