From 740cbf36beff04167473cc293a72b0442b74e701 Mon Sep 17 00:00:00 2001 From: zhihui wu Date: Tue, 16 May 2017 13:56:28 +0800 Subject: delete unuse code in directory /qtip Change-Id: I6732c7cf572d5b744c3a176ce266b9739e9233fd Signed-off-by: zhihui wu --- qtip/collector/calculator.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 qtip/collector/calculator.py (limited to 'qtip/collector/calculator.py') 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 -- cgit 1.2.3-korg