accel: add method for getting per-channel opcode stats
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Ic3cc0ddc5907e113b6d9d752c9bff0f526458a11 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17625 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
3570d392ac
commit
3a99974701
@ -691,6 +691,26 @@ int spdk_accel_set_opts(const struct spdk_accel_opts *opts);
|
||||
*/
|
||||
void spdk_accel_get_opts(struct spdk_accel_opts *opts);
|
||||
|
||||
struct spdk_accel_opcode_stats {
|
||||
/** Number of executed operations */
|
||||
uint64_t executed;
|
||||
/** Number of failed operations */
|
||||
uint64_t failed;
|
||||
/** Number of processed bytes */
|
||||
uint64_t num_bytes;
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
* Retrieve opcode statistics for a given IO channel.
|
||||
*
|
||||
* \param ch I/O channel.
|
||||
* \param opcode Operation to retrieve statistics.
|
||||
* \param stats Per-channel statistics.
|
||||
* \param size Size of the `stats` structure.
|
||||
*/
|
||||
void spdk_accel_get_opcode_stats(struct spdk_io_channel *ch, enum accel_opcode opcode,
|
||||
struct spdk_accel_opcode_stats *stats, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -2715,4 +2715,26 @@ accel_get_stats(accel_get_stats_cb cb_fn, void *cb_arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
spdk_accel_get_opcode_stats(struct spdk_io_channel *ch, enum accel_opcode opcode,
|
||||
struct spdk_accel_opcode_stats *stats, size_t size)
|
||||
{
|
||||
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
|
||||
|
||||
#define FIELD_OK(field) \
|
||||
offsetof(struct spdk_accel_opcode_stats, field) + sizeof(stats->field) <= size
|
||||
|
||||
#define SET_FIELD(field, value) \
|
||||
if (FIELD_OK(field)) { \
|
||||
stats->field = value; \
|
||||
}
|
||||
|
||||
SET_FIELD(executed, accel_ch->stats.operations[opcode].executed);
|
||||
SET_FIELD(failed, accel_ch->stats.operations[opcode].failed);
|
||||
SET_FIELD(num_bytes, accel_ch->stats.operations[opcode].num_bytes);
|
||||
|
||||
#undef FIELD_OK
|
||||
#undef SET_FIELD
|
||||
}
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT(accel)
|
||||
|
@ -39,6 +39,7 @@
|
||||
spdk_accel_get_memory_domain;
|
||||
spdk_accel_set_opts;
|
||||
spdk_accel_get_opts;
|
||||
spdk_accel_get_opcode_stats;
|
||||
|
||||
# functions needed by modules
|
||||
spdk_accel_module_list_add;
|
||||
|
Loading…
Reference in New Issue
Block a user