diff options
author | Yiting.Li <liyiting@huawei.com> | 2016-01-20 11:01:43 +0800 |
---|---|---|
committer | Yiting.Li <liyiting@huawei.com> | 2016-01-20 11:01:43 +0800 |
commit | 194ae04e266f63512a8f041f6bfd0dc330cd81af (patch) | |
tree | 6054415a0c9de8617076766c43dedaccbd6997cc /vstf | |
parent | 830b8c8c9f158fad8f9b1fc0977ae6deee3e9bed (diff) |
JIRA: BOTTLENECKS-41 define the documents of vstf in B release
Change-Id: Ib2ef6fabf0452a3e686d3de0ec7424e9a0500482
Signed-off-by: Yiting.Li <liyiting@huawei.com>
Diffstat (limited to 'vstf')
-rwxr-xr-x | vstf/vstf/agent/perf/qperf.py | 2 | ||||
-rwxr-xr-x | vstf/vstf/common/daemon.py | 63 | ||||
-rwxr-xr-x | vstf/vstf/common/perfmark.py | 4 | ||||
-rwxr-xr-x | vstf/vstf/controller/res/logo.jpg | bin | 544271 -> 4713 bytes | |||
-rwxr-xr-x | vstf/vstf/controller/sw_perf/performance.py | 4 |
5 files changed, 37 insertions, 36 deletions
diff --git a/vstf/vstf/agent/perf/qperf.py b/vstf/vstf/agent/perf/qperf.py index f84f9c24..afdf44d7 100755 --- a/vstf/vstf/agent/perf/qperf.py +++ b/vstf/vstf/agent/perf/qperf.py @@ -133,7 +133,7 @@ class Qperf(object): if data[3] == "us": latency = float(data[2]) / 1000 else: - latency = float(data[2]) / 1000 + latency = float(data[2]) result = { mark.minLatency: latency, mark.avgLatency: latency, diff --git a/vstf/vstf/common/daemon.py b/vstf/vstf/common/daemon.py index 1085d36c..35933dad 100755 --- a/vstf/vstf/common/daemon.py +++ b/vstf/vstf/common/daemon.py @@ -20,45 +20,46 @@ class Daemon(object): Usage: subclass the Daemon class and override the run() method """ + def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): super(Daemon, self).__init__() self.stdin = stdin self.stdout = stdout self.stderr = stderr self.pidfile = pidfile - + def daemonize(self): """ do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 """ - try: - pid = os.fork() + try: + pid = os.fork() if pid > 0: - sys.exit(0) - except OSError, e: + sys.exit(0) + except OSError, e: LOG.error("fork #1 failed: %(errno)s, %(strerror)s", - {'errno':e.errno, 'strerror': e.strerror}) + {'errno': e.errno, 'strerror': e.strerror}) sys.exit(1) - + # decouple from parent environment - os.chdir("/") - os.setsid() - os.umask(0) - + os.chdir("/") + os.setsid() + os.umask(0) + # do second fork - try: - pid = os.fork() + try: + pid = os.fork() if pid > 0: # exit from second parent - sys.exit(0) - except OSError, e: + sys.exit(0) + except OSError, e: LOG.error("fork #1 failed: %(errno)s, %(strerror)s", - {'errno':e.errno, 'strerror': e.strerror}) - sys.exit(1) - - # redirect standard file descriptors + {'errno': e.errno, 'strerror': e.strerror}) + sys.exit(1) + + # redirect standard file descriptors sys.stdout.flush() sys.stderr.flush() si = file(self.stdin, 'r') @@ -67,12 +68,12 @@ class Daemon(object): os.dup2(si.fileno(), sys.stdin.fileno()) os.dup2(so.fileno(), sys.stdout.fileno()) os.dup2(se.fileno(), sys.stderr.fileno()) - + # write pidfile atexit.register(self.delpid) pid = str(os.getpid()) - file(self.pidfile,'w+').write("%s\n" % pid) - + file(self.pidfile, 'w+').write("%s\n" % pid) + def delpid(self): os.remove(self.pidfile) @@ -80,15 +81,15 @@ class Daemon(object): """ Start the daemon """ - + # Check for a pidfile to see if the daemon already runs try: - pf = file(self.pidfile,'r') + pf = file(self.pidfile, 'r') pid = int(pf.read().strip()) pf.close() except IOError: pid = None - + if pid: message = "pidfile %s already exist. Daemon already running?\n" sys.stderr.write(message % self.pidfile) @@ -104,16 +105,16 @@ class Daemon(object): """ # Get the pid from the pidfile try: - pf = file(self.pidfile,'r') + pf = file(self.pidfile, 'r') pid = int(pf.read().strip()) pf.close() except IOError: pid = None - + if not pid: message = "pidfile %s does not exist. Daemon not running?\n" sys.stderr.write(message % self.pidfile) - return # not an error in a restart + return # not an error in a restart # Try killing the daemon process try: @@ -144,10 +145,10 @@ class Daemon(object): """ pass - + def daemon_die(self): - """You should this method when you shutdown daemon + """You should override this method when you shutdown daemon this func will be call by stop() before kill the process """ - pass
\ No newline at end of file + pass diff --git a/vstf/vstf/common/perfmark.py b/vstf/vstf/common/perfmark.py index 5edfe3a4..4f5c3978 100755 --- a/vstf/vstf/common/perfmark.py +++ b/vstf/vstf/common/perfmark.py @@ -19,5 +19,5 @@ rxCount = 'RxFrameCount' duration = 'Duration' cpu = 'CPU' mppsGhz = 'MppspGhz' -rxMbps = "RxMbit" -txMbps = 'TxMbit' +rxMbps = "RxMbps" +txMbps = 'TxMbps' diff --git a/vstf/vstf/controller/res/logo.jpg b/vstf/vstf/controller/res/logo.jpg Binary files differindex 683acfe0..9d524829 100755 --- a/vstf/vstf/controller/res/logo.jpg +++ b/vstf/vstf/controller/res/logo.jpg diff --git a/vstf/vstf/controller/sw_perf/performance.py b/vstf/vstf/controller/sw_perf/performance.py index 7e6467ee..3fe91e93 100755 --- a/vstf/vstf/controller/sw_perf/performance.py +++ b/vstf/vstf/controller/sw_perf/performance.py @@ -268,8 +268,8 @@ class Performance(object): record[mark.rxCount] += nic_data['rxpck'] record[mark.txCount] += nic_data['txpck'] record[mark.bandwidth] += nic_data['rxpck/s'] - record[mark.rxMbps] += nic_data['rxmB/s'] - record[mark.txMbps] += nic_data['txmB/s'] + record[mark.rxMbps] += nic_data['rxmB/s'] * 8 + record[mark.txMbps] += nic_data['txmB/s'] * 8 if record[mark.rxMbps] > record[mark.txMbps]: record[mark.rxMbps], record[mark.txMbps] = record[mark.txMbps], record[mark.rxMbps] |