Open CAS Framework
Open source framework of Cache Acceleration Software
ocf_trace.h
1 /*
2  * Copyright(c) 2012-2020 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause-Clear
4  */
5 
6 #ifndef __OCF_TRACE_H__
7 #define __OCF_TRACE_H__
8 
9 #include "ocf_def.h"
10 #include "ocf_types.h"
11 
12 typedef uint64_t log_sid_t;
13 
14 #define OCF_EVENT_VERSION 1
15 #define OCF_TRACING_STOP 1
16 
20 typedef enum {
23  ocf_event_type_cache_desc,
24 
26  ocf_event_type_core_desc,
27 
29  ocf_event_type_io,
30 
32  ocf_event_type_io_cmpl,
33 
35  ocf_event_type_io_file,
36 } ocf_event_type;
37 
41 struct ocf_event_hdr {
43  log_sid_t sid;
44 
46  uint64_t timestamp;
47 
49  ocf_event_type type;
50 
52  uint32_t size;
53 };
54 
60  struct ocf_event_hdr hdr;
61 
63  const char *name;
64 
67 
70 
72  uint64_t cache_size;
73 
75  uint32_t cores_no;
76 
78  uint32_t version;
79 };
80 
86  struct ocf_event_hdr hdr;
87 
89  const char *name;
90 
92  uint64_t core_size;
93 };
94 
96 typedef enum {
98  ocf_event_operation_rd = 'R',
99 
101  ocf_event_operation_wr = 'W',
102 
104  ocf_event_operation_flush = 'F',
105 
107  ocf_event_operation_discard = 'D',
108 } ocf_event_operation_t;
109 
113 struct ocf_event_io {
115  struct ocf_event_hdr hdr;
116 
118  uint64_t addr;
119 
121  uint32_t len;
122 
124  uint32_t io_class;
125 
127  const char *core_name;
128 
130  ocf_event_operation_t operation;
131 };
132 
138  struct ocf_event_hdr hdr;
139 
141  log_sid_t rsid;
142 
144  bool is_hit;
145 };
146 
147 
159 typedef void (*ocf_trace_callback_t)(ocf_cache_t cache, void *trace_ctx,
160  ocf_queue_t queue, const void* trace, const uint32_t size);
161 
172 int ocf_mngt_start_trace(ocf_cache_t cache, void *trace_ctx,
173  ocf_trace_callback_t trace_callback);
174 
183 int ocf_mngt_stop_trace(ocf_cache_t cache);
184 
185 #endif /* __OCF_TRACE_H__ */
struct ocf_cache * ocf_cache_t
handle to object designating ocf cache device
Definition: ocf_types.h:44
Core trace description.
Definition: ocf_trace.h:84
ocf_cache_mode_t cache_mode
Definition: ocf_trace.h:69
OCF definitions.
uint64_t core_size
Definition: ocf_trace.h:92
uint64_t cache_size
Definition: ocf_trace.h:72
IO trace event.
Definition: ocf_trace.h:113
IO completion event.
Definition: ocf_trace.h:136
ocf_event_operation_t operation
Definition: ocf_trace.h:130
uint64_t addr
Definition: ocf_trace.h:118
ocf_cache_line_size_t cache_line_size
Definition: ocf_trace.h:66
ocf_cache_mode_t
Definition: ocf_def.h:149
bool is_hit
Definition: ocf_trace.h:144
ocf_cache_line_size_t
Definition: ocf_def.h:258
ocf_event_type type
Definition: ocf_trace.h:49
OCF types.
uint32_t len
Definition: ocf_trace.h:121
uint32_t version
Definition: ocf_trace.h:78
uint32_t cores_no
Definition: ocf_trace.h:75
const char * name
Definition: ocf_trace.h:89
Cache trace description.
Definition: ocf_trace.h:58
struct ocf_queue * ocf_queue_t
handle to I/O queue
Definition: ocf_types.h:78
uint32_t io_class
Definition: ocf_trace.h:124
uint32_t size
Definition: ocf_trace.h:52
log_sid_t rsid
Definition: ocf_trace.h:141
log_sid_t sid
Definition: ocf_trace.h:43
const char * name
Definition: ocf_trace.h:63
Generic OCF trace event.
Definition: ocf_trace.h:41
uint64_t timestamp
Definition: ocf_trace.h:46
const char * core_name
Definition: ocf_trace.h:127