Updated parsing IO class statistics for cache/core

Signed-off-by: Daniel Madej <daniel.madej@intel.com>
This commit is contained in:
Daniel Madej 2020-01-21 16:28:17 +01:00
parent 33d5ed1685
commit 8bfa2ad83e
3 changed files with 20 additions and 20 deletions

View File

@ -3,14 +3,14 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
from api.cas.cli import *
from api.cas.casadm_parser import *
from test_utils.os_utils import *
from api.cas.cache_config import *
from storage_devices.device import Device
from core.test_run import TestRun
from api.cas.casadm_params import *
from api.cas.casadm_parser import *
from api.cas.cli import *
from api.cas.statistics import CacheStats, IoClassStats
from core.test_run import TestRun
from storage_devices.device import Device
from test_utils.os_utils import *
class Cache:
@ -99,7 +99,7 @@ class Cache:
percentage_val: bool = False):
stats = get_statistics(self.cache_id, None, io_class_id,
stat_filter, percentage_val)
return IoClassStats(stats)
return IoClassStats(stats, for_cache=True)
def get_statistics(self,
stat_filter: List[StatsFilter] = None,

View File

@ -4,17 +4,16 @@
#
from api.cas.cli import *
from api.cas.casadm_parser import *
from datetime import timedelta
from api.cas.cache import Device
from api.cas.casadm_parser import *
from api.cas.cli import *
from api.cas.statistics import CoreStats, IoClassStats
from test_tools import fs_utils
from test_utils.os_utils import *
from api.cas.statistics import CoreStats, IoClassStats
from datetime import timedelta, datetime
from test_utils.os_utils import wait
import time
class CoreStatus(Enum):
empty = 0,
@ -59,7 +58,7 @@ class Core(Device):
percentage_val: bool = False):
stats = get_statistics(self.cache_id, self.core_id, io_class_id,
stat_filter, percentage_val)
return IoClassStats(stats)
return IoClassStats(stats, for_cache=False)
def get_statistics(self,
stat_filter: List[StatsFilter] = None,

View File

@ -196,7 +196,7 @@ class CoreStats:
class IoClassStats:
stats_list = ["config_stats", "usage_stats", "request_stats", "block_stats"]
def __init__(self, stats):
def __init__(self, stats, for_cache: bool):
try:
self.config_stats = IoClassConfigStats(
stats["io class id"],
@ -230,16 +230,17 @@ class IoClassStats:
except KeyError:
pass
try:
plural = "(s)" if for_cache else ""
self.block_stats = BlockStats(
stats["reads from core(s)"],
stats["writes to core(s)"],
stats["total to/from core(s)"],
stats["reads from core" + plural],
stats["writes to core" + plural],
stats["total to/from core" + plural],
stats["reads from cache"],
stats["writes to cache"],
stats["total to/from cache"],
stats["reads from exported object(s)"],
stats["writes to exported object(s)"],
stats["total to/from exported object(s)"],
stats["reads from exported object" + plural],
stats["writes to exported object" + plural],
stats["total to/from exported object" + plural],
)
except KeyError:
pass