pyocf: adjust pyocf to new core stats api
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
89de6038c1
commit
5f357272d1
@ -25,7 +25,7 @@ from .data import Data
|
|||||||
from .io import Io, IoDir
|
from .io import Io, IoDir
|
||||||
from .queue import Queue
|
from .queue import Queue
|
||||||
from .shared import Uuid, OcfCompletion, OcfError, SeqCutOffPolicy
|
from .shared import Uuid, OcfCompletion, OcfError, SeqCutOffPolicy
|
||||||
from .stats.core import CoreStats
|
from .stats.core import CoreInfo
|
||||||
from .stats.shared import UsageStats, RequestsStats, BlocksStats, ErrorsStats
|
from .stats.shared import UsageStats, RequestsStats, BlocksStats, ErrorsStats
|
||||||
from .volume import Volume
|
from .volume import Volume
|
||||||
from ..ocf import OcfLib
|
from ..ocf import OcfLib
|
||||||
@ -111,7 +111,7 @@ class Core:
|
|||||||
return Io.from_pointer(io)
|
return Io.from_pointer(io)
|
||||||
|
|
||||||
def get_stats(self):
|
def get_stats(self):
|
||||||
core_stats = CoreStats()
|
core_info = CoreInfo()
|
||||||
usage = UsageStats()
|
usage = UsageStats()
|
||||||
req = RequestsStats()
|
req = RequestsStats()
|
||||||
blocks = BlocksStats()
|
blocks = BlocksStats()
|
||||||
@ -125,8 +125,8 @@ class Core:
|
|||||||
self.cache.read_unlock()
|
self.cache.read_unlock()
|
||||||
raise OcfError("Failed collecting core stats", status)
|
raise OcfError("Failed collecting core stats", status)
|
||||||
|
|
||||||
status = self.cache.owner.lib.ocf_core_get_stats(
|
status = self.cache.owner.lib.ocf_core_get_info(
|
||||||
self.handle, byref(core_stats)
|
self.handle, byref(core_info)
|
||||||
)
|
)
|
||||||
if status:
|
if status:
|
||||||
self.cache.read_unlock()
|
self.cache.read_unlock()
|
||||||
@ -134,10 +134,10 @@ class Core:
|
|||||||
|
|
||||||
self.cache.read_unlock()
|
self.cache.read_unlock()
|
||||||
return {
|
return {
|
||||||
"size": Size(core_stats.core_size_bytes),
|
"size": Size(core_info.core_size_bytes),
|
||||||
"dirty_for": timedelta(seconds=core_stats.dirty_for),
|
"dirty_for": timedelta(seconds=core_info.dirty_for),
|
||||||
"seq_cutoff_policy": SeqCutOffPolicy(core_stats.seq_cutoff_policy),
|
"seq_cutoff_policy": SeqCutOffPolicy(core_info.seq_cutoff_policy),
|
||||||
"seq_cutoff_threshold": core_stats.seq_cutoff_threshold,
|
"seq_cutoff_threshold": core_info.seq_cutoff_threshold,
|
||||||
"usage": struct_to_dict(usage),
|
"usage": struct_to_dict(usage),
|
||||||
"req": struct_to_dict(req),
|
"req": struct_to_dict(req),
|
||||||
"blocks": struct_to_dict(blocks),
|
"blocks": struct_to_dict(blocks),
|
||||||
@ -207,8 +207,8 @@ lib.ocf_mngt_core_set_seq_cutoff_policy.argtypes = [c_void_p, c_uint32]
|
|||||||
lib.ocf_mngt_core_set_seq_cutoff_policy.restype = c_int
|
lib.ocf_mngt_core_set_seq_cutoff_policy.restype = c_int
|
||||||
lib.ocf_stats_collect_core.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]
|
lib.ocf_stats_collect_core.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]
|
||||||
lib.ocf_stats_collect_core.restype = c_int
|
lib.ocf_stats_collect_core.restype = c_int
|
||||||
lib.ocf_core_get_stats.argtypes = [c_void_p, c_void_p]
|
lib.ocf_core_get_info.argtypes = [c_void_p, c_void_p]
|
||||||
lib.ocf_core_get_stats.restype = c_int
|
lib.ocf_core_get_info.restype = c_int
|
||||||
lib.ocf_core_new_io_wrapper.argtypes = [
|
lib.ocf_core_new_io_wrapper.argtypes = [
|
||||||
c_void_p,
|
c_void_p,
|
||||||
c_void_p,
|
c_void_p,
|
||||||
|
@ -9,22 +9,13 @@ from ctypes import c_uint32, c_uint64, Structure
|
|||||||
from .shared import OcfStatsReq, OcfStatsBlock, OcfStatsDebug, OcfStatsError
|
from .shared import OcfStatsReq, OcfStatsBlock, OcfStatsDebug, OcfStatsError
|
||||||
|
|
||||||
|
|
||||||
class CoreStats(Structure):
|
class CoreInfo(Structure):
|
||||||
_fields_ = [
|
_fields_ = [
|
||||||
("core_size", c_uint64),
|
("core_size", c_uint64),
|
||||||
("core_size_bytes", c_uint64),
|
("core_size_bytes", c_uint64),
|
||||||
("cache_occupancy", c_uint32),
|
|
||||||
("dirty", c_uint32),
|
("dirty", c_uint32),
|
||||||
("flushed", c_uint32),
|
("flushed", c_uint32),
|
||||||
("dirty_for", c_uint32),
|
("dirty_for", c_uint32),
|
||||||
("read_reqs", OcfStatsReq),
|
|
||||||
("write_reqs", OcfStatsReq),
|
|
||||||
("cache_volume", OcfStatsBlock),
|
|
||||||
("core_volume", OcfStatsBlock),
|
|
||||||
("core", OcfStatsBlock),
|
|
||||||
("cache_errors", OcfStatsError),
|
|
||||||
("core_errors", OcfStatsError),
|
|
||||||
("debug_stat", OcfStatsDebug),
|
|
||||||
("seq_cutoff_threshold", c_uint32),
|
("seq_cutoff_threshold", c_uint32),
|
||||||
("seq_cutoff_policy", c_uint32),
|
("seq_cutoff_policy", c_uint32),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user