LuaProc::~LuaProc () {
#ifdef WITH_LUAPROC_STATS
if (_info && _stats_cnt > 0) {
- printf ("LuaProc: '%s' run() avg: %.3f max: %.3f [ms]\n",
+ printf ("LuaProc: '%s' run() avg: %.3f max: %.3f [ms] p: %.1f\n",
_info->name.c_str (),
0.0001f * _stats_avg[0] / (float) _stats_cnt,
- 0.0001f * _stats_max[0]);
- printf ("LuaProc: '%s' gc() avg: %.3f max: %.3f [ms]\n",
+ 0.0001f * _stats_max[0],
+ _stats_max[0] * (float)_stats_cnt / _stats_avg[0]);
+ printf ("LuaProc: '%s' gc() avg: %.3f max: %.3f [ms] p: %.1f\n",
_info->name.c_str (),
0.0001f * _stats_avg[1] / (float) _stats_cnt,
- 0.0001f * _stats_max[1]);
+ 0.0001f * _stats_max[1],
+ _stats_max[1] * (float)_stats_cnt / _stats_avg[1]);
}
#endif
lua.do_command ("collectgarbage();");
LuaProc::init ()
{
#ifdef WITH_LUAPROC_STATS
- _stats_avg[0] = _stats_avg[1] = _stats_max[0] = _stats_max[1] = _stats_cnt = 0;
+ _stats_avg[0] = _stats_avg[1] = _stats_max[0] = _stats_max[1] = 0;
+ _stats_cnt = -25;
#endif
- lua.tweak_rt_gc ();
lua.Print.connect (sigc::mem_fun (*this, &LuaProc::lua_print));
// register session object
lua_State* L = lua.getState ();
+ lua_mlock (L, 1);
LuaBindings::stddef (L);
LuaBindings::common (L);
LuaBindings::dsp (L);
.addFunction ("name", &LuaProc::name)
.endClass ()
.endNamespace ();
+ lua_mlock (L, 0);
// add session to global lua namespace
luabridge::push <Session *> (L, &_session);
int64_t t1 = g_get_monotonic_time ();
#endif
- lua.collect_garbage_step (100 /*kB*/);
+ lua.collect_garbage_step ();
#ifdef WITH_LUAPROC_STATS
- ++_stats_cnt;
- int64_t t2 = g_get_monotonic_time ();
- int64_t ela0 = t1 - t0;
- int64_t ela1 = t2 - t1;
- if (ela0 > _stats_max[0]) _stats_max[0] = ela0;
- if (ela1 > _stats_max[1]) _stats_max[1] = ela1;
- _stats_avg[0] += ela0;
- _stats_avg[1] += ela1;
+ if (++_stats_cnt > 0) {
+ int64_t t2 = g_get_monotonic_time ();
+ int64_t ela0 = t1 - t0;
+ int64_t ela1 = t2 - t1;
+ if (ela0 > _stats_max[0]) _stats_max[0] = ela0;
+ if (ela1 > _stats_max[1]) _stats_max[1] = ela1;
+ _stats_avg[0] += ela0;
+ _stats_avg[1] += ela1;
+ }
#endif
return 0;
}
n_outputs.set (DataType::AUDIO, 1);
type = Lua;
- _is_instrument = category == "Instrument";
}
PluginPtr