mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add support for Tracy profiler (#15113)
This commit is contained in:
parent
6f23de41fb
commit
4aec4fbe6f
19 changed files with 379 additions and 4 deletions
|
@ -75,6 +75,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "gameparams.h"
|
||||
#include "particles.h"
|
||||
#include "gettext.h"
|
||||
#include "util/tracy_wrapper.h"
|
||||
|
||||
class ClientNotFoundException : public BaseException
|
||||
{
|
||||
|
@ -101,6 +102,8 @@ private:
|
|||
|
||||
void *ServerThread::run()
|
||||
{
|
||||
ZoneScoped;
|
||||
|
||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
/*
|
||||
|
@ -110,6 +113,7 @@ void *ServerThread::run()
|
|||
* server-step frequency. Receive() is used for waiting between the steps.
|
||||
*/
|
||||
|
||||
auto framemarker = FrameMarker("ServerThread::run()-frame").started();
|
||||
try {
|
||||
m_server->AsyncRunStep(0.0f, true);
|
||||
} catch (con::ConnectionBindFailed &e) {
|
||||
|
@ -119,10 +123,12 @@ void *ServerThread::run()
|
|||
} catch (ModError &e) {
|
||||
m_server->setAsyncFatalError(e.what());
|
||||
}
|
||||
framemarker.end();
|
||||
|
||||
float dtime = 0.0f;
|
||||
|
||||
while (!stopRequested()) {
|
||||
framemarker.start();
|
||||
ScopeProfiler spm(g_profiler, "Server::RunStep() (max)", SPT_MAX);
|
||||
|
||||
u64 t0 = porting::getTimeUs();
|
||||
|
@ -149,6 +155,7 @@ void *ServerThread::run()
|
|||
}
|
||||
|
||||
dtime = 1e-6f * (porting::getTimeUs() - t0);
|
||||
framemarker.end();
|
||||
}
|
||||
|
||||
END_DEBUG_EXCEPTION_HANDLER
|
||||
|
@ -607,6 +614,9 @@ void Server::step()
|
|||
|
||||
void Server::AsyncRunStep(float dtime, bool initial_step)
|
||||
{
|
||||
ZoneScoped;
|
||||
auto framemarker = FrameMarker("Server::AsyncRunStep()-frame").started();
|
||||
|
||||
{
|
||||
// Send blocks to clients
|
||||
SendBlocks(dtime);
|
||||
|
@ -1055,6 +1065,9 @@ void Server::AsyncRunStep(float dtime, bool initial_step)
|
|||
|
||||
void Server::Receive(float timeout)
|
||||
{
|
||||
ZoneScoped;
|
||||
auto framemarker = FrameMarker("Server::Receive()-frame").started();
|
||||
|
||||
const u64 t0 = porting::getTimeUs();
|
||||
const float timeout_us = timeout * 1e6f;
|
||||
auto remaining_time_us = [&]() -> float {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue