Motr  M0
stats_srv.c File Reference
#include "lib/trace.h"
#include "lib/tlist.h"
#include "lib/assert.h"
#include "lib/misc.h"
#include "lib/memory.h"
#include "rpc/item.h"
#include "fop/fop_item_type.h"
#include "rpc/rpc_opcodes.h"
#include "stats/stats_srv.h"
#include "fop/fop.h"
#include "fop/fom_generic.h"
#include "reqh/reqh_service.h"
#include "stats/stats_fops.h"
#include "stats/stats_fops_xc.h"
Include dependency graph for stats_srv.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_STATS
 
#define SUM_DATA_SIZE(sum_data)   (sum_data->ss_data.se_nr * sizeof(uint64_t))
 
#define REP_STATS_SUM_DATA(rep_fop, i)   (rep_fop->sqrf_stats.sf_stats[i].ss_data.se_data)
 

Functions

 M0_TL_DESCR_DEFINE (stats, "statistic objects", M0_INTERNAL, struct m0_stats, s_linkage, s_magic, M0_STATS_MAGIC, M0_STATS_HEAD_MAGIC)
 
 M0_TL_DEFINE (stats, M0_INTERNAL, struct m0_stats)
 
 M0_BOB_DEFINE (static, &stats_svc_bob, stats_svc)
 
static bool stats_svc_invariant (const struct stats_svc *svc)
 
static int stats_svc_rso_start (struct m0_reqh_service *service)
 
static void stats_svc_rso_stop (struct m0_reqh_service *service)
 
static void stats_svc_rso_fini (struct m0_reqh_service *service)
 
static int stats_svc_rsto_service_allocate (struct m0_reqh_service **srv, const struct m0_reqh_service_type *stype)
 
M0_INTERNAL int m0_stats_svc_init (void)
 
M0_INTERNAL void m0_stats_svc_fini (void)
 
static int stats_update_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static int stats_update_fom_tick (struct m0_fom *fom)
 
static void stats_update_fom_fini (struct m0_fom *fom)
 
static size_t stats_fom_home_locality (const struct m0_fom *fom)
 
static bool stats_invariant (const struct m0_stats *stats)
 
M0_INTERNAL struct m0_statsm0_stats_get (struct m0_tl *stats_list, uint64_t id)
 
static int stats_sum_copy (struct m0_stats_sum *s, struct m0_stats_sum *d)
 
static int stats_add (struct m0_tl *stats_list, struct m0_stats_sum *sum)
 
static int stats_update (struct m0_fom *fom)
 
static int stats_query_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static int stats_query_fom_tick (struct m0_fom *fom)
 
static void stats_query_fom_fini (struct m0_fom *fom)
 
static int read_stats (struct m0_fom *fom)
 

Variables

static const struct m0_bob_type stats_svc_bob
 
const struct m0_fom_type_ops stats_update_fom_type_ops
 
const struct m0_fom_type_ops stats_query_fom_type_ops
 
const struct m0_sm_conf stats_update_fom_sm_conf
 
const struct m0_sm_conf stats_query_fom_sm_conf
 
static const struct m0_reqh_service_ops stats_svc_ops
 
static const struct m0_reqh_service_type_ops stats_service_type_ops
 
struct m0_reqh_service_type m0_stats_svc_type
 
struct m0_fom_ops stats_update_fom_ops
 
struct m0_sm_state_descr stats_update_phases []
 
static const struct m0_fom_ops stats_query_fom_ops
 
struct m0_sm_state_descr stats_query_phases []
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_STATS

Definition at line 177 of file stats_srv.c.

◆ REP_STATS_SUM_DATA

#define REP_STATS_SUM_DATA (   rep_fop,
  i 
)    (rep_fop->sqrf_stats.sf_stats[i].ss_data.se_data)

◆ SUM_DATA_SIZE

#define SUM_DATA_SIZE (   sum_data)    (sum_data->ss_data.se_nr * sizeof(uint64_t))

Definition at line 211 of file stats_srv.c.

Function Documentation

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( static  ,
stats_svc_bob,
stats_svc   
)

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( stats  ,
M0_INTERNAL  ,
struct m0_stats   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( stats  ,
"statistic objects"  ,
M0_INTERNAL  ,
struct m0_stats  ,
s_linkage  ,
s_magic  ,
M0_STATS_MAGIC  ,
M0_STATS_HEAD_MAGIC   
)

◆ read_stats()

static int read_stats ( struct m0_fom fom)
static

Definition at line 568 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_add()

static int stats_add ( struct m0_tl stats_list,
struct m0_stats_sum sum 
)
static
Todo:
Is it required to check valid m0_stats_sum::ss_id from some some list? How ? need some global stats id list.

Definition at line 394 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_fom_home_locality()

static size_t stats_fom_home_locality ( const struct m0_fom fom)
static

Get stats update FOM locality.

Definition at line 526 of file stats_srv.c.

◆ stats_invariant()

static bool stats_invariant ( const struct m0_stats stats)
static

Definition at line 366 of file stats_srv.c.

Here is the caller graph for this function:

◆ stats_query_fom_create()

static int stats_query_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Create and initialize stats query FOM.

Definition at line 617 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_query_fom_fini()

static void stats_query_fom_fini ( struct m0_fom fom)
static

Finalise stats query FOM.

Definition at line 708 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_query_fom_tick()

static int stats_query_fom_tick ( struct m0_fom fom)
static

State transition function for stats query FOM.

Note
only M0_FOPH_QUEUE_REPLY & M0_FOPH_QUEUE_REPLY_WAIT are required.

Definition at line 679 of file stats_srv.c.

Here is the call graph for this function:

◆ stats_sum_copy()

static int stats_sum_copy ( struct m0_stats_sum s,
struct m0_stats_sum d 
)
static

Definition at line 380 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_svc_invariant()

static bool stats_svc_invariant ( const struct stats_svc svc)
static

Definition at line 216 of file stats_srv.c.

Here is the caller graph for this function:

◆ stats_svc_rso_fini()

static void stats_svc_rso_fini ( struct m0_reqh_service service)
static

The rso_fini method to finalise the Stats service.

Definition at line 241 of file stats_srv.c.

Here is the call graph for this function:

◆ stats_svc_rso_start()

static int stats_svc_rso_start ( struct m0_reqh_service service)
static

The rso_start methods to start stats service.

Definition at line 224 of file stats_srv.c.

Here is the call graph for this function:

◆ stats_svc_rso_stop()

static void stats_svc_rso_stop ( struct m0_reqh_service service)
static

The rso_stop method to stop Stats service.

Definition at line 233 of file stats_srv.c.

Here is the call graph for this function:

◆ stats_svc_rsto_service_allocate()

static int stats_svc_rsto_service_allocate ( struct m0_reqh_service **  srv,
const struct m0_reqh_service_type stype 
)
static

Definition at line 270 of file stats_srv.c.

Here is the call graph for this function:

◆ stats_update()

static int stats_update ( struct m0_fom fom)
static

Definition at line 425 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_update_fom_create()

static int stats_update_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Create and initiate stats update FOM.

Definition at line 458 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_update_fom_fini()

static void stats_update_fom_fini ( struct m0_fom fom)
static

Finalise stats update FOM.

Definition at line 512 of file stats_srv.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_update_fom_tick()

static int stats_update_fom_tick ( struct m0_fom fom)
static

State transition function for stats update FOM.

Definition at line 485 of file stats_srv.c.

Here is the call graph for this function:

Variable Documentation

◆ stats_query_fom_ops

const struct m0_fom_ops stats_query_fom_ops
static
Initial value:
= {
.fo_home_locality = stats_fom_home_locality,
}
static void stats_query_fom_fini(struct m0_fom *fom)
Definition: stats_srv.c:708
static int stats_query_fom_tick(struct m0_fom *fom)
Definition: stats_srv.c:679
static size_t stats_fom_home_locality(const struct m0_fom *fom)
Definition: stats_srv.c:526

Stats update FOM operation vector.

Definition at line 542 of file stats_srv.c.

◆ stats_query_fom_sm_conf

const struct m0_sm_conf stats_query_fom_sm_conf
Initial value:
= {
.scf_name = "stats-query-fom-sm",
.scf_nr_states = ARRAY_SIZE(stats_query_phases),
.scf_state = stats_query_phases
}
struct m0_sm_state_descr stats_query_phases[]
Definition: stats_srv.c:555
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 209 of file stats_srv.c.

◆ stats_query_fom_type_ops

const struct m0_fom_type_ops stats_query_fom_type_ops
Initial value:
= {
.fto_create = stats_query_fom_create,
}
static int stats_query_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: stats_srv.c:617

Stats update FOP type operation vector.

Definition at line 207 of file stats_srv.c.

◆ stats_query_phases

struct m0_sm_state_descr stats_query_phases[]
Initial value:

Definition at line 555 of file stats_srv.c.

◆ stats_service_type_ops

const struct m0_reqh_service_type_ops stats_service_type_ops
static
Initial value:
= {
.rsto_service_allocate = stats_svc_rsto_service_allocate,
}
static int stats_svc_rsto_service_allocate(struct m0_reqh_service **srv, const struct m0_reqh_service_type *stype)
Definition: stats_srv.c:270

Definition at line 293 of file stats_srv.c.

◆ stats_svc_bob

const struct m0_bob_type stats_svc_bob
static
Initial value:
= {
.bt_name = "stats svc",
.bt_magix_offset = M0_MAGIX_OFFSET(struct stats_svc, ss_magic),
.bt_magix = M0_STATS_SVC_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

Definition at line 197 of file stats_srv.c.

◆ stats_svc_ops

const struct m0_reqh_service_ops stats_svc_ops
static
Initial value:
= {
.rso_start = stats_svc_rso_start,
.rso_stop = stats_svc_rso_stop,
.rso_fini = stats_svc_rso_fini
}
static void stats_svc_rso_fini(struct m0_reqh_service *service)
Definition: stats_srv.c:241
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
Definition: reqh_service.c:601
static int stats_svc_rso_start(struct m0_reqh_service *service)
Definition: stats_srv.c:224
static void stats_svc_rso_stop(struct m0_reqh_service *service)
Definition: stats_srv.c:233

Definition at line 262 of file stats_srv.c.

◆ stats_update_fom_ops

struct m0_fom_ops stats_update_fom_ops
Initial value:
= {
.fo_home_locality = stats_fom_home_locality,
}
static int stats_update_fom_tick(struct m0_fom *fom)
Definition: stats_srv.c:485
static size_t stats_fom_home_locality(const struct m0_fom *fom)
Definition: stats_srv.c:526
static void stats_update_fom_fini(struct m0_fom *fom)
Definition: stats_srv.c:512

Stats update FOM operation vector.

Definition at line 330 of file stats_srv.c.

◆ stats_update_fom_sm_conf

const struct m0_sm_conf stats_update_fom_sm_conf
Initial value:
= {
.scf_name = "stats-update-fom-sm",
.scf_nr_states = ARRAY_SIZE(stats_update_phases),
.scf_state = stats_update_phases
}
struct m0_sm_state_descr stats_update_phases[]
Definition: stats_srv.c:343
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 208 of file stats_srv.c.

◆ stats_update_fom_type_ops

const struct m0_fom_type_ops stats_update_fom_type_ops
Initial value:
= {
.fto_create = stats_update_fom_create,
}
static int stats_update_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: stats_srv.c:458

Stats update FOP type operation vector.

Definition at line 206 of file stats_srv.c.

◆ stats_update_phases

struct m0_sm_state_descr stats_update_phases[]
Initial value:
= {
.sd_flags = M0_SDF_INITIAL,
.sd_name = "Init",
},
.sd_name = "Update",
},
.sd_flags = M0_SDF_TERMINAL,
.sd_name = "Finish",
.sd_allowed = 0
},
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 343 of file stats_srv.c.