Split retrieving core stats and config info into two functions.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2019-09-02 09:07:19 -04:00
parent f9da89263b
commit 89de6038c1
4 changed files with 72 additions and 45 deletions

View File

@@ -16,6 +16,32 @@
#include "ocf_io.h"
#include "ocf_mngt.h"
struct ocf_core_info {
/** Core size in cache line size unit */
uint64_t core_size;
/** Core size in bytes unit */
uint64_t core_size_bytes;
/** Fields refers ongoing flush operation */
struct {
/** Number of blocks flushed in ongoing flush operation */
uint32_t flushed;
/** Number of blocks left to flush in ongoing flush operation */
uint32_t dirty;
};
/** How long core is dirty in seconds unit */
uint32_t dirty_for;
/** Sequential cutoff threshold (in bytes) */
uint32_t seq_cutoff_threshold;
/** Sequential cutoff policy */
ocf_seq_cutoff_policy seq_cutoff_policy;
};
/**
* @brief Get OCF core by name
*
@@ -202,4 +228,15 @@ typedef int (*ocf_core_visitor_t)(ocf_core_t core, void *cntx);
int ocf_core_visit(ocf_cache_t cache, ocf_core_visitor_t visitor, void *cntx,
bool only_opened);
/**
* @brief Get info of given core object
*
* @param[in] core Core object
* @param[out] info Core info structure
*
* @retval 0 Success
* @retval Non-zero Fail
*/
int ocf_core_get_info(ocf_core_t core, struct ocf_core_info *info);
#endif /* __OCF_CORE_H__ */

View File

@@ -111,24 +111,12 @@ struct ocf_stats_core_debug {
* @brief OCF core statistics
*/
struct ocf_stats_core {
/** Core size in cache line size unit */
uint64_t core_size;
/** Core size in bytes unit */
uint64_t core_size_bytes;
/** Number of cache lines allocated in the cache for this core */
uint32_t cache_occupancy;
/** Number of dirty cache lines allocated in the cache for this core */
uint32_t dirty;
/** Number of block flushed in ongoing flush operation */
uint32_t flushed;
/** How long core is dirty in seconds unit */
uint32_t dirty_for;
/** Read requests statistics */
struct ocf_stats_req read_reqs;
@@ -152,12 +140,6 @@ struct ocf_stats_core {
/** Debug statistics */
struct ocf_stats_core_debug debug_stat;
/** Sequential cutoff threshold (in bytes) */
uint32_t seq_cutoff_threshold;
/** Sequential cutoff policy */
ocf_seq_cutoff_policy seq_cutoff_policy;
};
/**