MCPcopy Create free account
hub / github.com/apache/trafficserver / _RecRegisterRawStat

Function _RecRegisterRawStat

src/records/RecRawStats.cc:56–94  ·  view source on GitHub ↗

------------------------------------------------------------------------- RecRegisterRawStat -------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

54// RecRegisterRawStat
55//-------------------------------------------------------------------------
56int
57_RecRegisterRawStat(RecRawStatBlock *rsb, RecT rec_type, const char *name, RecDataT data_type, RecPersistT persist_type, int id,
58 RecRawStatSyncCb sync_cb)
59{
60 Dbg(dbg_ctl_stats, "RecRawStatSyncCb(%s): rsb pointer:%p id:%d", name, rsb, id);
61
62 // check to see if we're good to proceed
63 ink_assert(id < rsb->max_stats);
64
65 int err = REC_ERR_OKAY;
66
67 RecRecord *r;
68 RecData data_default;
69 memset(&data_default, 0, sizeof(RecData));
70
71 // register the record
72 if ((r = RecRegisterStat(rec_type, name, data_type, data_default, persist_type)) == nullptr) {
73 err = REC_ERR_FAIL;
74 goto Ldone;
75 }
76
77 r->rsb_id = id; // This is the index within the RSB raw block for this stat, used for lookups by name.
78 if (i_am_the_record_owner(r->rec_type)) {
79 r->sync_required = r->sync_required | REC_PEER_SYNC_REQUIRED;
80 }
81
82 // store a pointer to our record->stat_meta.data_raw in our rsb
83 rsb->global[id] = &(r->stat_meta.data_raw);
84 rsb->global[id]->last_sum = 0;
85 rsb->global[id]->last_count = 0;
86
87 // setup the periodic sync callback
88 if (sync_cb) {
89 RecRegisterRawStatSyncCb(name, sync_cb, rsb, id);
90 }
91
92Ldone:
93 return err;
94}
95
96//-------------------------------------------------------------------------
97// RecRawStatSync...

Callers

nothing calls this directly

Calls 4

memsetFunction · 0.85
RecRegisterStatFunction · 0.85
i_am_the_record_ownerFunction · 0.85
RecRegisterRawStatSyncCbFunction · 0.85

Tested by

no test coverage detected