Remove low-level stats getters from public API.

Since stats builder is implemented for retrieving cache, core and ioclass stats,
adapters should use it instead.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2019-09-03 04:15:36 -04:00
parent 5f357272d1
commit 42d6dbbf11
4 changed files with 348 additions and 368 deletions

View File

@@ -23,6 +23,132 @@ struct ocf_counters_req {
env_atomic64 pass_through;
};
/**
* @brief OCF requests statistics like hit, miss, etc...
*
* @note To calculate number of hits request do:
* total - (partial_miss + full_miss)
*/
struct ocf_stats_req {
/** Number of partial misses */
uint64_t partial_miss;
/** Number of full misses */
uint64_t full_miss;
/** Total of requests */
uint64_t total;
/** Pass-through requests */
uint64_t pass_through;
};
/**
* @brief OCF error statistics
*/
struct ocf_stats_error {
/** Read errors */
uint32_t read;
/** Write errors */
uint32_t write;
};
/**
* @brief OCF block statistics in bytes
*/
struct ocf_stats_block {
/** Number of blocks read */
uint64_t read;
/** Number of blocks written */
uint64_t write;
};
/**
* Statistics appropriate for given IO class
*/
struct ocf_stats_io_class {
/** Number of cache lines available for given partition */
uint64_t free_clines;
/** Number of cache lines within lru list */
uint64_t occupancy_clines;
/** Number of dirty cache lines assigned to specific partition */
uint64_t dirty_clines;
/** Read requests statistics */
struct ocf_stats_req read_reqs;
/** Writes requests statistics */
struct ocf_stats_req write_reqs;
/** Block requests for ocf volume statistics */
struct ocf_stats_block blocks;
/** Block requests for cache volume statistics */
struct ocf_stats_block cache_blocks;
/** Block requests for core volume statistics */
struct ocf_stats_block core_blocks;
};
#define IO_PACKET_NO 12
#define IO_ALIGN_NO 4
/**
* @brief Core debug statistics
*/
struct ocf_stats_core_debug {
/** I/O sizes being read (grouped by packets) */
uint64_t read_size[IO_PACKET_NO];
/** I/O sizes being written (grouped by packets) */
uint64_t write_size[IO_PACKET_NO];
/** I/O alignment for reads */
uint64_t read_align[IO_ALIGN_NO];
/** I/O alignment for writes */
uint64_t write_align[IO_ALIGN_NO];
};
/**
* @brief OCF core statistics
*/
struct ocf_stats_core {
/** 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;
/** Read requests statistics */
struct ocf_stats_req read_reqs;
/** Write requests statistics */
struct ocf_stats_req write_reqs;
/** Block requests for cache volume statistics */
struct ocf_stats_block cache_volume;
/** Block requests for core volume statistics */
struct ocf_stats_block core_volume;
/** Block requests submitted by user to this core */
struct ocf_stats_block core;
/** Cache volume error statistics */
struct ocf_stats_error cache_errors;
/** Core volume error statistics */
struct ocf_stats_error core_errors;
/** Debug statistics */
struct ocf_stats_core_debug debug_stat;
};
/**
* statistics appropriate for given io class.
*/
@@ -56,4 +182,45 @@ struct ocf_counters_core {
#endif
};
/**
* @brief ocf_core_io_class_get_stats retrieve io class statistics
* for given core
*
* Retrieve buffer of cache statistics for given cache instance.
*
* @param[in] core core handle to which request pertains
* @param[in] part_id IO class, stats of which are requested
* @param[out] stats statistic structure that shall be filled as
* a result of this function invocation.
*
* @result zero upon successful completion; error code otherwise
*/
int ocf_core_io_class_get_stats(ocf_core_t core, ocf_part_id_t part_id,
struct ocf_stats_io_class *stats);
/**
* @brief retrieve core stats
*
* Retrieve ocf per core stats (for all IO classes together)
*
* @param[in] core core ID to which request pertains
* @param[out] stats statistics structure that shall be filled as
* a result of this function invocation.
*
* @result zero upon successful completion; error code otherwise
*/
int ocf_core_get_stats(ocf_core_t core, struct ocf_stats_core *stats);
/**
* @brief update DEBUG stats given IO request
*
* Function meant to update DEBUG stats for IO request.
*
* @note This function shall be invoked for each IO request processed
*
* @param[in] core to which request pertains
* @param[in] io request for which stats are being updated
*/
void ocf_core_update_stats(ocf_core_t core, struct ocf_io *io);
#endif