177 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_STATS 191 #include "stats/stats_fops_xc.h" 211 #define SUM_DATA_SIZE(sum_data) (sum_data->ss_data.se_nr * sizeof(uint64_t)) 218 return stats_svc_bob_check(
svc);
253 stats_tlink_del_fini(stats_obj);
258 stats_svc_bob_fini(
svc);
279 return M0_ERR_INFO(-ENOMEM,
"Failed to allocate memory.");
282 (*srv)->rs_type =
stype;
285 stats_svc_bob_init(
svc);
286 stats_tlist_init(&
svc->ss_stats);
301 .rst_typecode = M0_CST_STATS,
377 stats_obj->s_sum.ss_id ==
id));
409 if (new_stats ==
NULL)
410 return M0_ERR_INFO(-ENOMEM,
"Failed to allocate memory.");
419 stats_tlink_init(new_stats);
420 stats_tlist_add_tail(stats_list, new_stats);
443 if (stats_obj !=
NULL) {
468 if (stats_ufom ==
NULL)
469 return M0_ERR_INFO(-ENOMEM,
"Failed to allocate memory.");
592 if (stats_obj ==
NULL) {
593 rep_fop->sqrf_stats.sf_stats[
i].ss_data.se_nr = 0;
600 #undef REP_STATS_SUM_DATA 601 #define REP_STATS_SUM_DATA(rep_fop, i) \ 602 (rep_fop->sqrf_stats.sf_stats[i].ss_data.se_data) 631 if (stats_qfom ==
NULL)
632 return M0_ERR_INFO(-ENOMEM,
"Failed to allocate memory.");
635 if (qrep_fop ==
NULL) {
653 goto free_qrep_fop_stats;
719 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL int m0_reqh_service_state_get(const struct m0_reqh_service *s)
static int stats_svc_rsto_service_allocate(struct m0_reqh_service **srv, const struct m0_reqh_service_type *stype)
void m0_fom_phase_moveif(struct m0_fom *fom, int32_t rc, int phase0, int phase1)
#define M0_ALLOC_ARR(arr, nr)
int(* rso_start)(struct m0_reqh_service *service)
struct m0_sm_state_descr stats_query_phases[]
M0_INTERNAL void m0_stats_svc_fini(void)
int(* fo_tick)(struct m0_fom *fom)
struct m0_uint64_seq ss_data
M0_TL_DEFINE(stats, M0_INTERNAL, struct m0_stats)
static void stats_query_fom_fini(struct m0_fom *fom)
static const struct m0_fom_ops stats_query_fom_ops
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
#define REP_STATS_SUM_DATA(rep_fop, i)
struct m0_stats_recs sqrf_stats
struct m0_sm_state_descr stats_update_phases[]
#define container_of(ptr, type, member)
int m0_reqh_service_type_register(struct m0_reqh_service_type *rstype)
static int stats_add(struct m0_tl *stats_list, struct m0_stats_sum *sum)
struct m0_fom_type ft_fom_type
struct m0_uint64_seq sqf_ids
static const struct m0_reqh_service_type_ops stats_service_type_ops
static int stats_update_fom_tick(struct m0_fom *fom)
void m0_fom_init(struct m0_fom *fom, const struct m0_fom_type *fom_type, const struct m0_fom_ops *ops, struct m0_fop *fop, struct m0_fop *reply, struct m0_reqh *reqh)
struct m0_fop_type * f_type
struct m0_rpc_machine * m0_fop_rpc_machine(const struct m0_fop *fop)
#define M0_ERR_INFO(rc, fmt,...)
return M0_ERR(-EOPNOTSUPP)
static void stats_svc_rso_fini(struct m0_reqh_service *service)
struct m0_stats_sum s_sum
static const struct socktype stype[]
static int stats_update_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
static int stats_sum_copy(struct m0_stats_sum *s, struct m0_stats_sum *d)
int m0_fom_tick_generic(struct m0_fom *fom)
void m0_fom_fini(struct m0_fom *fom)
const struct m0_sm_conf stats_update_fom_sm_conf
static int stats_query_fom_tick(struct m0_fom *fom)
static int stats_update(struct m0_fom *fom)
M0_TL_DESCR_DEFINE(stats, "statistic objects", M0_INTERNAL, struct m0_stats, s_linkage, s_magic, M0_STATS_MAGIC, M0_STATS_HEAD_MAGIC)
static struct m0_fop reply_fop
#define bob_of(ptr, type, field, bt)
struct m0_stats_sum * sf_stats
M0_INTERNAL struct m0_stats_query_rep_fop * m0_stats_query_rep_fop_get(struct m0_fop *fop)
static size_t stats_fom_home_locality(const struct m0_fom *fom)
M0_BOB_DEFINE(static, &stats_svc_bob, stats_svc)
M0_INTERNAL struct m0_stats_query_fop * m0_stats_query_fop_get(struct m0_fop *fop)
struct m0_stats_recs suf_stats
static bool stats_svc_invariant(const struct stats_svc *svc)
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
static int stats_svc_rso_start(struct m0_reqh_service *service)
M0_INTERNAL int m0_stats_svc_init(void)
#define M0_MAGIX_OFFSET(type, field)
struct m0_fom_ops stats_update_fom_ops
int(* rsto_service_allocate)(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
static bool stats_invariant(const struct m0_stats *stats)
#define M0_ALLOC_PTR(ptr)
static struct m0_net_test_service svc
struct m0_reqh_service_type m0_stats_svc_type
static struct m0_fop * fop
struct m0_reqh_service ss_reqhs
static void stats_svc_rso_stop(struct m0_reqh_service *service)
#define SUM_DATA_SIZE(sum_data)
const struct m0_fom_type_ops stats_query_fom_type_ops
static void stats_update_fom_fini(struct m0_fom *fom)
static int read_stats(struct m0_fom *fom)
M0_INTERNAL struct m0_stats * m0_stats_get(struct m0_tl *stats_list, uint64_t id)
const struct m0_sm_conf stats_query_fom_sm_conf
void m0_fom_phase_set(struct m0_fom *fom, int phase)
static const struct m0_bob_type stats_svc_bob
#define m0_tl_find(name, var, head,...)
#define m0_tl_for(name, head, obj)
static struct m0_addb2_source * s
void m0_reqh_service_type_unregister(struct m0_reqh_service_type *rstype)
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
M0_INTERNAL struct m0_stats_update_fop * m0_stats_update_fop_get(struct m0_fop *fop)
static const struct m0_reqh_service_ops stats_svc_ops
const struct m0_fom_type_ops stats_update_fom_type_ops
struct m0_fop_type m0_fop_stats_query_rep_fopt
static struct net_srv srv
static int stats_query_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)
#define M0_IMPOSSIBLE(fmt,...)