mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[Fix] (Server): log the per-frame P65ServerFrame line only when MOBILEGL_SERVER_FRAME_STATS asks for it
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
#include <condition_variable>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#if defined(__ANDROID__)
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
#include <cstring>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
@@ -219,6 +222,23 @@ namespace MobileGL::MG_Remote::Server {
|
||||
return text != nullptr && text[0] != '\0';
|
||||
}
|
||||
|
||||
// The per-frame P65ServerFrame line is a measurement aid, not a log: at one line per present
|
||||
// of every session it floods the device log (and pushes the lines tests grep for out of the
|
||||
// ring). Opt in with MOBILEGL_SERVER_FRAME_STATS=1, or on Android the property
|
||||
// debug.mobilegl.server_frame_stats=1; read once.
|
||||
Bool ServerFrameStatsEnabled() {
|
||||
static const Bool enabled = [] {
|
||||
const char* value = std::getenv("MOBILEGL_SERVER_FRAME_STATS");
|
||||
#if defined(__ANDROID__)
|
||||
char property[PROP_VALUE_MAX] = {};
|
||||
if (value == nullptr && __system_property_get("debug.mobilegl.server_frame_stats", property) > 0)
|
||||
value = property;
|
||||
#endif
|
||||
return value != nullptr && value[0] != ' | ||||