Fix compilation errors after tracing introduction

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2019-01-14 17:28:51 +01:00
parent dd6b074258
commit d9cfab67b8
4 changed files with 28 additions and 19 deletions

View File

@ -172,7 +172,7 @@ typedef void (*ocf_trace_callback_t)(ocf_cache_t cache, void *trace_ctx,
* @retval 0 Tracing started successfully
* @retval Non-zero Error
*/
int ocf_mgnt_start_trace(ocf_cache_t cache, void *trace_ctx,
int ocf_mngt_start_trace(ocf_cache_t cache, void *trace_ctx,
ocf_trace_callback_t trace_callback);
/**
@ -183,6 +183,6 @@ int ocf_mgnt_start_trace(ocf_cache_t cache, void *trace_ctx,
* @retval 0 Tracing stopped successfully
* @retval Non-zero Error
*/
int ocf_mgnt_stop_trace(ocf_cache_t cache);
int ocf_mngt_stop_trace(ocf_cache_t cache);
#endif /* __OCF_TRACE_H__ */

View File

@ -27,10 +27,10 @@
*/
struct ocf_trace {
/* Placeholder for push_event callback */
volatile ocf_trace_callback_t trace_callback;
ocf_trace_callback_t trace_callback;
/* Telemetry context */
volatile void *trace_ctx;
void *trace_ctx;
env_atomic64 trace_seq_ref;
};

View File

@ -24,7 +24,9 @@ static int _ocf_core_desc(ocf_core_t core, void *ctx)
ocf_cache_t cache = visitor_ctx->cache;
ocf_event_init_hdr(&core_desc.hdr, ocf_event_type_core_desc,
ocf_trace_seq_id(cache), env_get_tick_ns(), sizeof(core_desc));
ocf_trace_seq_id(cache),
env_ticks_to_nsecs(env_get_tick_count()),
sizeof(core_desc));
core_desc.id = ocf_core_get_id(core);
core_desc.core_size = ocf_dobj_get_length(
ocf_core_get_data_object(core));
@ -42,7 +44,9 @@ static int _ocf_trace_cache_info(ocf_cache_t cache, uint32_t io_queue)
struct core_trace_visitor_ctx visitor_ctx;
ocf_event_init_hdr(&cache_desc.hdr, ocf_event_type_cache_desc,
ocf_trace_seq_id(cache), env_get_tick_ns(), sizeof(cache_desc));
ocf_trace_seq_id(cache),
env_ticks_to_nsecs(env_get_tick_count()),
sizeof(cache_desc));
cache_desc.id = ocf_cache_get_id(cache);
cache_desc.cache_line_size = ocf_cache_get_line_size(cache);
@ -70,10 +74,10 @@ static int _ocf_trace_cache_info(ocf_cache_t cache, uint32_t io_queue)
return retval;
}
int ocf_mgnt_start_trace(ocf_cache_t cache, void *trace_ctx,
int ocf_mngt_start_trace(ocf_cache_t cache, void *trace_ctx,
ocf_trace_callback_t trace_callback)
{
int result;
int queue, result;
uint32_t i;
OCF_CHECK_NULL(cache);
@ -98,9 +102,8 @@ int ocf_mgnt_start_trace(ocf_cache_t cache, void *trace_ctx,
cache->trace.trace_ctx = trace_ctx;
// Reset trace stop flag
for (int queue = 0; queue < cache->io_queues_no; queue++) {
for (queue = 0; queue < cache->io_queues_no; queue++)
env_atomic_set(&cache->io_queues[queue].trace_stop, 0);
}
for (i = 0; i < cache->io_queues_no; i++) {
result = _ocf_trace_cache_info(cache, i);
@ -121,9 +124,9 @@ trace_deinit:
return result;
}
int ocf_mgnt_stop_trace(ocf_cache_t cache)
int ocf_mngt_stop_trace(ocf_cache_t cache)
{
int result;
int queue, result;
result = ocf_mngt_cache_lock(cache);
if (result)
@ -138,8 +141,9 @@ int ocf_mgnt_stop_trace(ocf_cache_t cache)
}
// Set trace stop flag
for (int queue = 0; queue < cache->io_queues_no; queue++) {
env_atomic_set(&cache->io_queues[queue].trace_stop, OCF_TRACING_STOP);
for (queue = 0; queue < cache->io_queues_no; queue++) {
env_atomic_set(&cache->io_queues[queue].trace_stop,
OCF_TRACING_STOP);
}
cache->trace.trace_callback = NULL;

View File

@ -6,6 +6,8 @@
#ifndef __OCF_TRACE_PRIV_H__
#define __OCF_TRACE_PRIV_H__
#include "ocf/ocf.h"
#include "ocf_env.h"
#include "ocf/ocf_trace.h"
#include "engine/engine_common.h"
#include "ocf_request.h"
@ -14,11 +16,12 @@
static inline bool ocf_is_trace_ongoing(ocf_cache_t cache)
{
for (int i = 0; i < cache->io_queues_no; i++) {
if (env_atomic64_read(&cache->io_queues[i].trace_ref_cntr)) {
int i;
for (i = 0; i < cache->io_queues_no; i++) {
if (env_atomic64_read(&cache->io_queues[i].trace_ref_cntr))
return true;
}
}
return false;
}
@ -39,7 +42,7 @@ static inline uint64_t ocf_trace_seq_id(ocf_cache_t cache)
static inline void ocf_trace_init_io(struct ocf_core_io *io, ocf_cache_t cache)
{
io->timestamp = env_get_tick_ns();
io->timestamp = env_ticks_to_nsecs(env_get_tick_count());
io->sid = ocf_trace_seq_id(cache);
}
@ -120,7 +123,9 @@ static inline void ocf_trace_io_cmpl(struct ocf_core_io *io, ocf_cache_t cache)
rq = io->req;
ocf_event_init_hdr(&ev.hdr, ocf_event_type_io_cmpl,
ocf_trace_seq_id(cache), env_get_tick_ns(), sizeof(ev));
ocf_trace_seq_id(cache),
env_ticks_to_nsecs(env_get_tick_count()),
sizeof(ev));
ev.rsid = io->sid;
ev.is_hit = ocf_engine_is_hit(rq);