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

Function create_plugin_stats

plugins/lua/ts_lua.cc:86–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84} ts_lua_plugin_stats;
85
86ts_lua_plugin_stats *
87create_plugin_stats(ts_lua_main_ctx *const main_ctx_array, char const *const *stat_strs)
88{
89 auto *const stats = TSRalloc<ts_lua_plugin_stats>();
90 memset(stats, 0, sizeof(ts_lua_plugin_stats));
91
92 stats->main_ctx_array = main_ctx_array;
93
94 // sample buffers
95 stats->gc_kb = 0;
96 stats->threads = 0;
97
98 int const max_state_count = ts_lua_max_state_count;
99
100 for (int ind = 0; ind < TS_LUA_IND_SIZE; ++ind) {
101 stats->stat_inds[ind] = TSStatCreate(stat_strs[ind], TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM);
102 }
103
104 // initialize the number of states stat
105 int const sid = stats->stat_inds[TS_LUA_IND_STATE];
106 if (TS_ERROR != sid) {
107 TSStatIntSet(sid, max_state_count);
108 }
109
110 return stats;
111}
112
113ts_lua_main_ctx *
114create_lua_vms()

Callers 2

TSRemapInitFunction · 0.70
TSPluginInitFunction · 0.70

Calls 3

memsetFunction · 0.85
TSStatCreateFunction · 0.85
TSStatIntSetFunction · 0.85

Tested by

no test coverage detected