Update statistics usage to use stats classes
Rename set_statistics_deprecated to set_statistics_flat, as flat statistics are sometimes more useful and actually not deprecated. Signed-off-by: Daniel Madej <daniel.madej@intel.com>
This commit is contained in:
@@ -5,15 +5,16 @@
|
||||
|
||||
|
||||
import pytest
|
||||
from api.cas.casadm import StatsFilter
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas import ioclass_config
|
||||
from test_tools.dd import Dd
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||
from api.cas.casadm import StatsFilter
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_utils.size import Size, Unit
|
||||
from test_tools.dd import Dd
|
||||
from test_utils.os_utils import Udev
|
||||
from test_utils.size import Size, Unit
|
||||
|
||||
ioclass_config_path = "/tmp/opencas_ioclass.conf"
|
||||
mountpoint = "/tmp/cas1-1"
|
||||
@@ -112,8 +113,8 @@ def test_block_stats_write(cache_mode, zero_stats):
|
||||
for i in range(iterations):
|
||||
dd.seek(dd_seek)
|
||||
dd.run()
|
||||
cache_stats = cache.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
cache_stats = cache.get_statistics_flat(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_statistics_flat(stat_filter=[StatsFilter.blk])
|
||||
|
||||
# Check cache stats
|
||||
assumed_value = (dd_size.get_value(Unit.Blocks4096) * dd_count) * (i + 1)
|
||||
@@ -237,8 +238,8 @@ def test_block_stats_read(cache_mode, zero_stats):
|
||||
for i in range(iterations):
|
||||
dd.skip(dd_skip)
|
||||
dd.run()
|
||||
cache_stats = cache.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
cache_stats = cache.get_statistics_flat(stat_filter=[StatsFilter.blk])
|
||||
core_stats = core.get_statistics_flat(stat_filter=[StatsFilter.blk])
|
||||
|
||||
# Check cache stats
|
||||
assumed_value = (dd_size.get_value(Unit.Blocks4096) * dd_count) * (i + 1)
|
||||
@@ -283,7 +284,7 @@ def test_block_stats_read(cache_mode, zero_stats):
|
||||
def flush(cache):
|
||||
cache.flush_cache()
|
||||
cache.reset_counters()
|
||||
stats = cache.get_statistics_deprecated(stat_filter=[StatsFilter.blk])
|
||||
stats = cache.get_statistics_flat(stat_filter=[StatsFilter.blk])
|
||||
for key, value in stats.items():
|
||||
assert value.get_value(Unit.Blocks4096) == 0
|
||||
|
||||
|
@@ -5,17 +5,18 @@
|
||||
|
||||
|
||||
import pytest
|
||||
from api.cas.casadm import StatsFilter
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas import ioclass_config
|
||||
from api.cas import casadm_parser
|
||||
from api.cas import ioclass_config
|
||||
from api.cas.cache_config import CleaningPolicy
|
||||
from api.cas.casadm import StatsFilter
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_utils.size import Size, Unit
|
||||
from test_utils.os_utils import sync, Udev
|
||||
from test_utils.filesystem.file import File
|
||||
from test_utils.os_utils import sync, Udev
|
||||
from test_utils.size import Size, Unit
|
||||
|
||||
ioclass_config_path = "/tmp/opencas_ioclass.conf"
|
||||
mountpoint = "/tmp/cas1-1"
|
||||
@@ -105,11 +106,11 @@ def test_ioclass_stats_sum():
|
||||
core.unmount()
|
||||
sync()
|
||||
|
||||
cache_stats = cache.get_statistics_deprecated(
|
||||
cache_stats = cache.get_statistics_flat(
|
||||
stat_filter=[StatsFilter.usage, StatsFilter.req, StatsFilter.blk]
|
||||
)
|
||||
for ioclass_id in ioclass_id_list:
|
||||
ioclass_stats = cache.get_statistics_deprecated(
|
||||
ioclass_stats = cache.get_statistics_flat(
|
||||
stat_filter=[StatsFilter.usage, StatsFilter.req, StatsFilter.blk],
|
||||
io_class_id=ioclass_id,
|
||||
)
|
||||
|
Reference in New Issue
Block a user