| 84 | } ts_lua_plugin_stats; |
| 85 | |
| 86 | ts_lua_plugin_stats * |
| 87 | create_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 | |
| 113 | ts_lua_main_ctx * |
| 114 | create_lua_vms() |
no test coverage detected