aboutsummaryrefslogtreecommitdiffstats
path: root/qtip/collector
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2017-05-16 13:56:28 +0800
committerzhihui wu <wu.zhihui1@zte.com.cn>2017-05-16 14:30:51 +0800
commit740cbf36beff04167473cc293a72b0442b74e701 (patch)
tree8a3b6f62fdd7d4e5522033f4ed216776931609aa /qtip/collector
parent1089daee7bbf76a1686b6e1f4fee8dc79b5b7968 (diff)
delete unuse code in directory /qtip
Change-Id: I6732c7cf572d5b744c3a176ce266b9739e9233fd Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'qtip/collector')
-rw-r--r--qtip/collector/calculator.py38
-rw-r--r--qtip/collector/parser/grep.py66
-rw-r--r--qtip/collector/parser/regex.yaml85
3 files changed, 0 insertions, 189 deletions
diff --git a/qtip/collector/calculator.py b/qtip/collector/calculator.py
deleted file mode 100644
index c3d961b3..00000000
--- a/qtip/collector/calculator.py
+++ /dev/null
@@ -1,38 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corp and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from operator import add
-
-from qtip.util.logger import QtipLogger
-
-logger = QtipLogger('calculator').get
-
-
-def dpi_calculator(samples):
- try:
- float_pps = map(lambda x: float(x), samples['pps'])
- float_bps = map(lambda x: float(x), samples['bps'])
- sum_dpi_pps = reduce(add,
- map(lambda x: x / 1000 if x > 100 else x, float_pps))
- sum_dpi_bps = reduce(add,
- map(lambda x: x / 1000 if x > 100 else x, float_bps))
-
- return {'pps': round(sum_dpi_pps / 10, 3), 'bps': round(sum_dpi_bps / 10, 3)}
- except Exception as error:
- logger.error(error)
- return {'pps': None, 'bps': None}
-
-
-def calculate_cpu_usage(cpu_idle):
- try:
- cpu_usage = round((100.0 - float(cpu_idle)), 3)
- return '{0}%'.format(str(cpu_usage))
- except Exception, error:
- logger.error(error)
- return None
diff --git a/qtip/collector/parser/grep.py b/qtip/collector/parser/grep.py
index d3a8210a..66b51b1e 100644
--- a/qtip/collector/parser/grep.py
+++ b/qtip/collector/parser/grep.py
@@ -7,21 +7,15 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from collections import defaultdict
-from os import path
import re
-import yaml
from qtip.base import BaseActor
from qtip.base.constant import BaseProp
-from qtip.collector import calculator
from qtip.util.logger import QtipLogger
logger = QtipLogger('grep').get
-REGEX_FILE = path.join(path.dirname(__file__), 'regex.yaml')
-
class GrepProp(BaseProp):
FILENAME = 'filename'
@@ -40,63 +34,3 @@ def grep_in_file(filename, regex):
with open(filename, 'r') as f:
return filter(lambda x: x is not None,
re.finditer(regex, f.read(), re.MULTILINE))
-
-
-def _parse_logfile(config, paths):
- captured = {}
- for regex_rules_by_file in config:
- filename = \
- '{0}/{1}'.format(paths, regex_rules_by_file[GrepProp.FILENAME])
- for regex in regex_rules_by_file['grep']:
- matches = grep_in_file(filename, regex)
- if len(matches) > 1:
- temp_dict = defaultdict(list)
- for item in [match.groupdict() for match in matches]:
- for key in item:
- temp_dict[key].append(item[key])
- captured.update(temp_dict)
- elif len(matches) == 1:
- captured.update(matches[0].groupdict())
- else:
- logger.error("Nothing is matched from {0}".format(filename))
- return captured
-
-
-# TODO: Hardcord in Danube, it will be removed in the future.
-def parse_sysinfo(config, result_dir):
- sysinfo = _parse_logfile(config, result_dir)
- if "cpu_idle" in sysinfo:
- sysinfo['cpu_usage'] = \
- calculator.calculate_cpu_usage(sysinfo['cpu_idle'])
- sysinfo.pop('cpu_idle')
- return sysinfo
-
-
-# TODO: Hardcord in Danube, it will be removed in the future.
-def parse_test_result(benchmark, config, result_dir):
- test_result = _parse_logfile(config, result_dir)
- if benchmark == 'dpi':
- return calculator.dpi_calculator(test_result)
- if benchmark == 'dhrystone' or benchmark == 'whetstone':
- return {'total_cpus': test_result['total_cpus'],
- 'single_cpu': {'num': test_result['single_cpu'],
- 'score': test_result['score'][0]},
- 'multi_cpus': {'num': test_result['multi_cpus'],
- 'score': test_result['score'][1]}}
- return test_result
-
-
-# TODO: Hardcord in Danube, it will be removed in the future.
-def parse_benchmark_result(result_dir):
- regex_config = yaml.safe_load(file(REGEX_FILE))
- benchmark = result_dir.split('/')[-1]
- result = {'name': benchmark}
-
- test_result = \
- parse_test_result(benchmark, regex_config[benchmark], result_dir)
- result['results'] = test_result.copy()
-
- sysinfo = parse_sysinfo(regex_config['sysinfo'], result_dir)
- result['sysinfo'] = sysinfo.copy()
-
- return result
diff --git a/qtip/collector/parser/regex.yaml b/qtip/collector/parser/regex.yaml
deleted file mode 100644
index e1512855..00000000
--- a/qtip/collector/parser/regex.yaml
+++ /dev/null
@@ -1,85 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-dhrystone:
- - filename: dhrystone
- grep:
- - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
- - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
- - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
- - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
-whetstone:
- - filename: whetstone
- grep:
- - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
- - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
- - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
- - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
-dpi:
- - filename: dpi_dump.txt
- grep:
- - |-
- ^\s+nDPI throughput:.+?(?P<pps>\d+.\d+)\s.+\spps.+
- ?(?P<bps>\d+.\d+)\s.+\/sec
-ramspeed:
- - filename: Intmem
- grep:
- - '^INTEGER\s+BatchRun\s+Copy:\s+?(?P<integer_copy>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+Scale:\s+?(?P<integer_scale>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+Add:\s+?(?P<integer_add>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<integer_triad>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<integer_average>\d+\.\d+)\sMB/s$'
- - filename: Floatmem
- grep:
- - '^FL-POINT\s+BatchRun\s+Copy:\s+?(?P<float_copy>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+Scale:\s+?(?P<float_scale>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<float_add>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<float_triad>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<float_average>\d+\.\d+)\sMB/s$'
-ssl:
- - filename: RSA_dump
- grep:
- - |-
- ^rsa\s+512\sbits\s.+\s+
- ?(?P<rsa_sign_512>\d+\.\d)\s+
- ?(?P<rsa_verify_512>\d+\.\d)$
- - |-
- ^rsa\s+1024\sbits\s.+\s+
- ?(?P<rsa_sign_1024>\d+\.\d)\s+
- ?(?P<rsa_verify_1024>\d+\.\d)$
- - |-
- ^rsa\s+2048\sbits\s.+\s+
- ?(?P<rsa_sign_2048>\d+\.\d)\s+
- ?(?P<rsa_verify_2048>\d+\.\d)$
- - |-
- ^rsa\s+4096\sbits\s.+\s+
- ?(?P<rsa_sign_4096>\d+\.\d)\s+
- ?(?P<rsa_verify_4096>\d+\.\d)$
- - filename: AES-128-CBC_dump
- grep:
- - |-
- ^aes-128-cbc\s+
- ?(?P<aes_128_cbc_16_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_64_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_256_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_1024_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_8192_bytes>\d+\.\w+)$
-sysinfo:
- - filename: top.log
- grep:
- - 'Cpu\(s\):.+?(?P<cpu_idle>\d+\.\d)\sid'
- - filename: inxi.log
- grep:
- - '.+\s+Host:\s+(?P<hostname>.+)\sKernel'
- - '.+\sMemory:\s+(?P<memory>.+MB)\s'
- - '^CPU\(s\):\s+(?P<cpu>.+)'
- - '.+\sDistro:\s+(?P<os>.+)'
- - '.+\sKernel:\s+(?P<kernel>.+)\sConsole'
- - '.+\s+HDD Total Size:\s+(?P<disk>.+)\s'
- - '.+\sproduct:\s+(?P<product>.+)\sv' \ No newline at end of file