From 8312bd4367395fdba877f084d1f72590f10c44c7 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Mon, 7 Sep 2015 00:44:50 +0100 Subject: Sysmetrics implementation update New sysmetrics implementation is based on pidstat command line tool from sysstat package. Old non-functional implementation was removed. Reporting was refactored to generate report after each TC from values already available in memory. Following files were affected: modified: conf/01_testcases.conf modified: conf/02_vswitch.conf modified: conf/05_collector.conf deleted: core/collector_controller.py modified: core/component_factory.py modified: docs/NEWS.rst modified: packages.txt modified: requirements.txt modified: testcases/testcase.py modified: tools/collectors/collector/collector.py modified: tools/collectors/sysmetrics/__init__.py deleted: tools/collectors/sysmetrics/linuxmetrics.py new file: tools/collectors/sysmetrics/pidstat.py modified: tools/report/report.jinja modified: tools/report/report.py modified: tools/systeminfo.py modified: vsperf JIRA: VSPERF-67 Change-Id: I25a79f2afef405b9ac46ae85c18044af167a62a4 Signed-off-by: Martin Klozik (martinx.klozik@intel.com) Reviewed-by: Billy O Mahony Reviewed-by: Maryam Tahhan Reviewed-by: Al Morton Reviewed-by: Gurpreet Singh Reviewed-by: Tv Rao --- tools/collectors/collector/collector.py | 37 +++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'tools/collectors/collector') diff --git a/tools/collectors/collector/collector.py b/tools/collectors/collector/collector.py index 27a07202..998c1f6f 100644 --- a/tools/collectors/collector/collector.py +++ b/tools/collectors/collector/collector.py @@ -15,24 +15,49 @@ """Abstract "system metrics logger" model. """ -CMD_PREFIX = 'metricscmd : ' - class ICollector(object): """This is an abstract class for system metrics loggers. """ - def log_mem_stats(self): - """Log memory statistics. + def start(self): + """Starts data collection. This method must be non-blocking. + It means, that collector must be executed as a background process. Where implemented, this function should raise an exception on failure. """ raise NotImplementedError('Please call an implementation.') - def log_cpu_stats(self): - """Log cpu statistics. + def stop(self): + """Stops data collection. Where implemented, this function should raise an exception on failure. """ raise NotImplementedError('Please call an implementation.') + + def get_results(self): + """Returns collected results. + + Where implemented, this function should raise an exception on + failure. + """ + raise NotImplementedError('Please call an implementation.') + + def print_results(self): + """Logs collected results. + + Where implemented, this function should raise an exception on + failure. + """ + raise NotImplementedError('Please call an implementation.') + + def __enter__(self): + """Starts up collection of statistics + """ + self.start() + + def __exit__(self, type_, value, traceback): + """Stops collection of statistics + """ + self.stop() -- cgit 1.2.3-korg