Add sequential cutoff debug interface
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
93cd0615d3
commit
e9afb40860
21
inc/ocf_debug.h
Normal file
21
inc/ocf_debug.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright(c) 2012-2018 Intel Corporation
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __OCF_DEBUG_H__
|
||||||
|
#define __OCF_DEBUG_H__
|
||||||
|
|
||||||
|
struct ocf_dbg_seq_cutoff_status {
|
||||||
|
struct {
|
||||||
|
uint64_t last;
|
||||||
|
uint64_t bytes;
|
||||||
|
uint32_t rw : 1;
|
||||||
|
uint32_t active : 1;
|
||||||
|
} streams[OCF_SEQ_CUTOFF_MAX_STREAMS];
|
||||||
|
};
|
||||||
|
|
||||||
|
void ocf_dbg_get_seq_cutoff_status(ocf_core_t core,
|
||||||
|
struct ocf_dbg_seq_cutoff_status *status);
|
||||||
|
|
||||||
|
#endif /* __OCF_DEBUG_H__ */
|
@ -6,6 +6,7 @@
|
|||||||
#include "ocf_seq_cutoff.h"
|
#include "ocf_seq_cutoff.h"
|
||||||
#include "ocf_cache_priv.h"
|
#include "ocf_cache_priv.h"
|
||||||
#include "ocf_priv.h"
|
#include "ocf_priv.h"
|
||||||
|
#include "ocf/ocf_debug.h"
|
||||||
|
|
||||||
#define SEQ_CUTOFF_FULL_MARGIN \
|
#define SEQ_CUTOFF_FULL_MARGIN \
|
||||||
(OCF_TO_EVICTION_MIN + OCF_PENDING_EVICTION_LIMIT)
|
(OCF_TO_EVICTION_MIN + OCF_PENDING_EVICTION_LIMIT)
|
||||||
@ -62,6 +63,29 @@ void ocf_core_seq_cutoff_init(ocf_core_t core)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ocf_dbg_get_seq_cutoff_status(ocf_core_t core,
|
||||||
|
struct ocf_dbg_seq_cutoff_status *status)
|
||||||
|
{
|
||||||
|
struct ocf_seq_cutoff_stream *stream;
|
||||||
|
uint32_t threshold;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
OCF_CHECK_NULL(core);
|
||||||
|
OCF_CHECK_NULL(status);
|
||||||
|
|
||||||
|
threshold = ocf_core_get_seq_cutoff_threshold(core);
|
||||||
|
|
||||||
|
env_rwlock_read_lock(&core->seq_cutoff.lock);
|
||||||
|
list_for_each_entry(stream, &core->seq_cutoff.lru, list) {
|
||||||
|
status->streams[i].last = stream->last;
|
||||||
|
status->streams[i].bytes = stream->bytes;
|
||||||
|
status->streams[i].rw = stream->rw;
|
||||||
|
status->streams[i].active = (stream->bytes >= threshold);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
env_rwlock_read_unlock(&core->seq_cutoff.lock);
|
||||||
|
}
|
||||||
|
|
||||||
bool ocf_core_seq_cutoff_check(ocf_core_t core, struct ocf_request *req)
|
bool ocf_core_seq_cutoff_check(ocf_core_t core, struct ocf_request *req)
|
||||||
{
|
{
|
||||||
ocf_seq_cutoff_policy policy = ocf_core_get_seq_cutoff_policy(core);
|
ocf_seq_cutoff_policy policy = ocf_core_get_seq_cutoff_policy(core);
|
||||||
|
Loading…
Reference in New Issue
Block a user