126 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_ADDB 144 #include "addb2/addb2_xc.h" 146 #include "addb2/storage_xc.h" 188 #define DEBUG_OWNERSHIP (1) 343 static,
struct buffer, b_linkage, b_magix,
399 const uint64_t *
value);
401 static uint64_t
tag(uint8_t code, uint64_t
id);
404 uint64_t
id,
int n,
const uint64_t *
value);
410 #define MACH_DEPTH(mach) (mach->ma_rec.ar_label_nr) 456 s->s_ops->so_fini(
s);
498 sensor_tlink_init_at_tail(
s, &te->
e_sensor);
511 if (sensor_tlink_is_in(
s)) {
515 sensor_tlink_fini(
s);
537 mach_tlink_init(
mach);
547 sensor_tlist_init(&
t->e_sensor);
581 mach_tlink_fini(
mach);
627 }
while (loc != loc_first);
667 buf->b_trace.o_tr.tr_nr = 0;
695 cur->cu_trace = trace;
710 while (
cur->cu_pos <
cur->cu_trace->tr_nr) {
711 uint64_t *
addr = &
cur->cu_trace->tr_body[
cur->cu_pos];
712 uint64_t datum =
addr[0];
714 uint64_t
tag = datum >> (64 - 8);
715 uint8_t
nr =
tag & 0xf;
721 switch (
tag & ~0xFULL) {
724 r->ar_label[
r->ar_label_nr ++] =
731 cur->cu_pos +=
nr + 2;
737 if (
r->ar_label_nr > 0) {
752 cur->cu_pos +=
nr + 2;
935 uint64_t
id,
int n,
const uint64_t *
value)
939 sizeof id +
sizeof now +
n *
sizeof value[0]);
1022 buf->b_trace.o_tr.tr_body = area;
1039 buf_tlink_fini(
buf);
1047 static uint64_t
tag(uint8_t code, uint64_t
id)
1050 return id | (((uint64_t)code) << (64 - 8));
1075 s->s_ops->so_snapshot(
s, area);
1086 uint64_t
id,
int n,
const uint64_t *
value)
1108 while (i < tr->
tr_nr) {
1110 uint64_t
tag = datum >> (64 - 8);
1111 uint8_t
nr =
tag & 0xf;
1114 switch (
tag & ~0xfull) {
1117 stack[
depth++] = datum;
1150 #undef M0_TRACE_SUBSYSTEM
void m0_addb2_force(m0_time_t delay)
int m0_addb2_module_init(void)
static struct m0_semaphore wait
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
M0_INTERNAL struct m0_locality * m0_locality_get(uint64_t value)
static void sensor_place(struct m0_addb2_mach *m, struct m0_addb2_sensor *s)
struct m0_addb2_value * e_recval
static struct m0_addb2_mach * m
M0_INTERNAL struct m0_addb2_module * m0_addb2_module_get(void)
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
const struct m0_addb2_mach_ops * ma_ops
uint64_t e_value[VALUE_MAX_NR]
struct m0_addb2_mach * tls_addb2_mach
static uint64_t tag(uint8_t code, uint64_t id)
#define M0_LOG(level,...)
static struct buffer * mach_buffer(struct m0_addb2_mach *mach)
static void mach_put(struct m0_addb2_mach *m)
int m0_addb2_cursor_next(struct m0_addb2_cursor *cur)
void m0_addb2_cursor_fini(struct m0_addb2_cursor *cur)
struct m0_addb2_trace_obj b_trace
int const char const void * value
void m0_addb2_mach_fini(struct m0_addb2_mach *mach)
static void mach_idle(struct m0_addb2_mach *m)
static struct tentry * mach_top(struct m0_addb2_mach *m)
static void pack(struct m0_addb2_mach *mach)
struct m0_addb2_source ma_src
M0_INTERNAL struct m0 * m0_get(void)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
int m0_locality_call(struct m0_locality *loc, int(*cb)(void *), void *data)
M0_INTERNAL uint64_t m0_addb2__dummy_payload[1]
M0_TL_DESCR_DEFINE(tr, "addb2 traces", M0_INTERNAL, struct m0_addb2_trace_obj, o_linkage, o_magix, M0_ADDB2_TRACE_MAGIC, M0_ADDB2_TRACE_HEAD_MAGIC)
M0_INTERNAL void m0_addb2__mach_print(const struct m0_addb2_mach *m)
struct m0_addb2_trace o_tr
#define M0_ASSERT_EX(cond)
M0_INTERNAL struct m0_thread_tls * m0_thread_tls(void)
M0_BASSERT(BUFFER_SIZE > M0_ADDB2_LABEL_MAX *3 *sizeof(uint64_t))
void m0_addb2_trace_done(const struct m0_addb2_trace *ctrace)
bool m0_time_is_in_past(m0_time_t t)
return M0_ERR(-EOPNOTSUPP)
struct m0_tlink ma_linkage
void m0_addb2_push(uint64_t id, int n, const uint64_t *value)
#define M0_AMB(obj, ptr, field)
#define m0_tl_teardown(name, head, obj)
void m0_addb2_module_fini(void)
static void buffer_add(struct buffer *buf, uint64_t datum)
static bool trace_invariant(const struct m0_addb2_trace *tr)
void m0_addb2_mach_stop(struct m0_addb2_mach *mach)
m0_time_t m0_time_now(void)
static struct m0_thread t[8]
M0_INTERNAL uint64_t m0_addb2__dummy_payload_size
void m0_addb2_sensor_add(struct m0_addb2_sensor *s, uint64_t id, unsigned nr, int idx, const struct m0_addb2_sensor_ops *ops)
void m0_addb2_consume(struct m0_addb2_source *src, const struct m0_addb2_record *rec)
M0_INTERNAL int m0_semaphore_init(struct m0_semaphore *semaphore, unsigned value)
void * m0_alloc(size_t size)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
struct m0_addb2_value ar_label[M0_ADDB2_LABEL_MAX]
struct m0_addb2_mach *(* m0_addb2__mach)(void)
static int addb2_force_loc_cb(void *unused)
static int buffer_alloc(struct m0_addb2_mach *mach)
M0_TL_DEFINE(tr, M0_INTERNAL, struct m0_addb2_trace_obj)
static __thread struct m0_thread_tls * tls
static m0_bcount_t buffer_space(const struct buffer *buffer)
void m0_addb2_cursor_init(struct m0_addb2_cursor *cur, const struct m0_addb2_trace *trace)
void m0_addb2_add(uint64_t id, int n, const uint64_t *value)
int(* apo_submit)(struct m0_addb2_mach *mach, struct m0_addb2_trace_obj *tobj)
m0_time_t m0_time_add(const m0_time_t t1, const m0_time_t t2)
void m0_addb2_pop(uint64_t id)
static void buffer_fini(struct buffer *buffer)
static void addb2_force_loc(struct m0_locality *loc)
struct m0_semaphore ma_idlewait
static void record_consume(struct m0_addb2_mach *m, uint64_t id, int n, const uint64_t *value)
M0_INTERNAL struct m0_locality * m0_locality0_get(void)
struct m0_tlink b_linkage
#define M0_FI_ENABLED(tag)
void(* apo_idle)(struct m0_addb2_mach *mach)
void * m0_addb2_mach_cookie(const struct m0_addb2_mach *mach)
struct m0_addb2_value ar_val
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL void m0_semaphore_fini(struct m0_semaphore *semaphore)
void * i_moddata[M0_MODULE_NR]
M0_INTERNAL struct m0_thread * m0_thread_self(void)
M0_INTERNAL m0_bcount_t m0_addb2_trace_size(const struct m0_addb2_trace *trace)
void m0_addb2_force_all(void)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
static struct m0_addb2_mach * mach(void)
#define M0_ASSERT_INFO(cond, fmt,...)
struct m0_addb2_record ma_rec
void m0_addb2_source_fini(struct m0_addb2_source *src)
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
void m0_addb2_sensor_del(struct m0_addb2_sensor *s)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
#define m0_tl_for(name, head, obj)
static struct m0_addb2_source * s
void m0_addb2_source_init(struct m0_addb2_source *src)
struct m0_addb2_source * m0_addb2_mach_source(struct m0_addb2_mach *m)
struct tentry ma_label[M0_ADDB2_LABEL_MAX]
const m0_time_t M0_TIME_IMMEDIATELY
static struct m0_addb2_frame_header last
void m0_addb2_mach_wait(struct m0_addb2_mach *mach)
struct m0_addb2_mach * m0_addb2_mach_init(const struct m0_addb2_mach_ops *ops, void *cookie)
static void add(struct m0_addb2_mach *mach, uint64_t id, int n, const uint64_t *value)