Skip to content

Commit 58877e6

Browse files
committed
Remove telemetry instrumentation from places
1 parent 4ef8aac commit 58877e6

File tree

7 files changed

+6
-128
lines changed

7 files changed

+6
-128
lines changed

Client/core/Graphics/CPixelsManager.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,6 @@
1111
#include "StdInc.h"
1212
#include "CFileFormat.h"
1313
#include "CPixelsManager.h"
14-
#include <CrashTelemetry.h>
15-
16-
namespace
17-
{
18-
const char* PixelsFormatToString(EPixelsFormatType format)
19-
{
20-
switch (format)
21-
{
22-
case EPixelsFormat::PLAIN:
23-
return "plain";
24-
case EPixelsFormat::JPEG:
25-
return "jpeg";
26-
case EPixelsFormat::PNG:
27-
return "png";
28-
case EPixelsFormat::DDS:
29-
return "dds";
30-
case EPixelsFormat::UNKNOWN:
31-
default:
32-
return "unknown";
33-
}
34-
}
35-
}
3614

3715
///////////////////////////////////////////////////////////////
3816
// Object creation
@@ -772,22 +750,6 @@ bool CPixelsManager::ChangePixelsFormat(const CPixels& oldPixels, CPixels& newPi
772750
if (oldFormat == EPixelsFormat::UNKNOWN || newFormat == EPixelsFormat::UNKNOWN)
773751
return false;
774752

775-
const uint sourceBytes = oldPixels.GetSize();
776-
uint width = 0;
777-
uint height = 0;
778-
GetPixelsSize(oldPixels, width, height);
779-
780-
SString telemetryDetail;
781-
telemetryDetail.Format("%s->%s q=%d bytes=%u dims=%ux%u",
782-
PixelsFormatToString(oldFormat),
783-
PixelsFormatToString(newFormat),
784-
uiQuality,
785-
sourceBytes,
786-
width,
787-
height);
788-
// Tag conversions here so crashes show which pixel formats/dimensions were being processed.
789-
CrashTelemetry::Scope conversionScope(sourceBytes, oldPixels.GetData(), "Pixels::ChangeFormat", telemetryDetail.c_str());
790-
791753
if (oldFormat == newFormat)
792754
{
793755
// No change

Client/mods/deathmatch/logic/CClientEntity.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -747,14 +747,6 @@ bool CClientEntity::CallEvent(const char* szName, const CLuaArguments& Arguments
747747
if (!g_pClientGame->GetDebugHookManager()->OnPreEvent(szName, Arguments, this, NULL))
748748
return false;
749749

750-
const SString& thisTypeName = GetTypeName();
751-
const char* thisTypeNameCStr = !thisTypeName.empty() ? thisTypeName.c_str() : "<unknown>";
752-
const ElementID thisId = GetID();
753-
SString telemetryDetail;
754-
telemetryDetail.Format("%s %s(%u)", szName, thisTypeNameCStr, thisId.Value());
755-
// Capture the element+event context so any crash (even core.dll faults) reports the last event being dispatched.
756-
CrashTelemetry::Scope entityScope(0, this, "Entity::CallEvent", telemetryDetail.c_str());
757-
758750
TIMEUS startTime = GetTimeUs();
759751

760752
CEvents* pEvents = g_pClientGame->GetEvents();

Client/mods/deathmatch/logic/CMapEventManager.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -187,32 +187,6 @@ bool CMapEventManager::Call(const char* szName, const CLuaArguments& Arguments,
187187
if (!g_pClientGame->GetDebugHookManager()->OnPreEventFunction(szName, Arguments, pSource, nullptr, pMapEvent))
188188
continue;
189189

190-
const char* scriptName = pMapEvent->GetVM()->GetScriptName();
191-
CResource* pEventResource = pMapEvent->GetVM()->GetResource();
192-
const char* resourceName = pEventResource ? pEventResource->GetName() : "<no-resource>";
193-
194-
SString sourceTag = "<null>";
195-
if (pSource)
196-
{
197-
const SString& sourceTypeName = pSource->GetTypeName();
198-
const char* sourceTypeNameCStr = !sourceTypeName.empty() ? sourceTypeName.c_str() : "<unknown>";
199-
sourceTag.Format("%s(%u)", sourceTypeNameCStr, pSource->GetID().Value());
200-
}
201-
202-
SString thisTag = "<null>";
203-
if (pThis)
204-
{
205-
const SString& thisTypeName = pThis->GetTypeName();
206-
const char* thisTypeNameCStr = !thisTypeName.empty() ? thisTypeName.c_str() : "<unknown>";
207-
thisTag.Format("%s(%u)", thisTypeNameCStr, pThis->GetID().Value());
208-
}
209-
210-
SString telemetryDetail;
211-
telemetryDetail.Format("%s::%s src=%s this=%s", scriptName, resourceName, sourceTag.c_str(), thisTag.c_str());
212-
// Tag each Lua event dispatch so crash dumps show which
213-
// resource/event/element executed last
214-
CrashTelemetry::Scope eventScope(0, pThis, "LuaEvent::Call", telemetryDetail.c_str());
215-
216190
// Store the current values of the globals
217191
lua_getglobal(pState, "source");
218192
CLuaArgument OldSource(pState, -1);

Client/mods/deathmatch/logic/lua/CLuaArguments.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ bool CLuaArguments::Call(CLuaMain* pLuaMain, const CLuaFunctionRef& iLuaFunction
202202
assert(pLuaMain);
203203
TIMEUS startTime = GetTimeUs();
204204

205-
const SString& functionTag = pLuaMain->GetFunctionTag(iLuaFunction.ToInt());
206-
CrashTelemetry::Scope telemetryScope(0, pLuaMain, "Lua::Call", functionTag.c_str());
207-
208205
// Add the function name to the stack and get the event from the table
209206
lua_State* luaVM = pLuaMain->GetVirtualMachine();
210207
assert(luaVM);
@@ -247,7 +244,7 @@ bool CLuaArguments::Call(CLuaMain* pLuaMain, const CLuaFunctionRef& iLuaFunction
247244
lua_pop(luaVM, 1);
248245
}
249246

250-
CClientPerfStatLuaTiming::GetSingleton()->UpdateLuaTiming(pLuaMain, functionTag, GetTimeUs() - startTime);
247+
CClientPerfStatLuaTiming::GetSingleton()->UpdateLuaTiming(pLuaMain, pLuaMain->GetFunctionTag(iLuaFunction.ToInt()), GetTimeUs() - startTime);
251248
return true;
252249
}
253250

@@ -257,8 +254,6 @@ bool CLuaArguments::CallGlobal(CLuaMain* pLuaMain, const char* szFunction, CLuaA
257254
assert(szFunction);
258255
TIMEUS startTime = GetTimeUs();
259256

260-
CrashTelemetry::Scope telemetryScope(0, pLuaMain, "Lua::CallGlobal", szFunction);
261-
262257
// Add the function name to the stack and get the event from the table
263258
lua_State* luaVM = pLuaMain->GetVirtualMachine();
264259
assert(luaVM);

Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,34 +1940,8 @@ int CLuaDrawingDefs::DxConvertPixels(lua_State* luaVM)
19401940

19411941
if (!argStream.HasErrors())
19421942
{
1943-
CPixelsManagerInterface* const pPixelsManager = g_pCore->GetGraphics()->GetPixelsManager();
1944-
uint width = 0;
1945-
uint height = 0;
1946-
EPixelsFormatType sourceFormat = EPixelsFormat::UNKNOWN;
1947-
if (pPixelsManager)
1948-
{
1949-
pPixelsManager->GetPixelsSize(pixels, width, height);
1950-
sourceFormat = pPixelsManager->GetPixelsFormat(pixels);
1951-
}
1952-
1953-
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
1954-
CResource* pResource = pLuaMain ? pLuaMain->GetResource() : nullptr;
1955-
const char* resourceName = pResource ? pResource->GetName() : "<no-resource>";
1956-
1957-
SString telemetryDetail;
1958-
telemetryDetail.Format("%s %s->%s q=%d bytes=%u dims=%ux%u",
1959-
resourceName,
1960-
EnumToString(sourceFormat).c_str(),
1961-
EnumToString(format).c_str(),
1962-
quality,
1963-
pixels.GetSize(),
1964-
width,
1965-
height);
1966-
// Capture resource + pixel metadata so crash dumps show what attempted the conversion and with which formats.
1967-
CrashTelemetry::Scope telemetryScope(pixels.GetSize(), pLuaMain, "dxConvertPixels", telemetryDetail.c_str());
1968-
19691943
CPixels newPixels;
1970-
if (pPixelsManager && pPixelsManager->ChangePixelsFormat(pixels, newPixels, format, quality))
1944+
if (g_pCore->GetGraphics()->GetPixelsManager()->ChangePixelsFormat(pixels, newPixels, format, quality))
19711945
{
19721946
lua_pushlstring(luaVM, newPixels.GetData(), newPixels.GetSize());
19731947
return 1;

Shared/sdk/SharedUtil.Buffer.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
#include "SharedUtil.Misc.h"
1616
#include "SharedUtil.File.h"
1717
#include "SString.h"
18-
#if defined(MTA_CLIENT) && defined(__cplusplus)
19-
#include "CrashTelemetry.h"
20-
#endif
2118

2219
namespace SharedUtil
2320
{
@@ -60,13 +57,7 @@ namespace SharedUtil
6057

6158
bool IsEmpty() const { return empty(); }
6259

63-
void Reserve(uint uiSize)
64-
{
65-
#if defined(MTA_CLIENT) && defined(__cplusplus)
66-
CrashTelemetry::Scope telemetryScope(uiSize, this, "SharedUtil::CBuffer::Reserve", nullptr);
67-
#endif
68-
reserve(uiSize);
69-
}
60+
void Reserve(uint uiSize) { return reserve(uiSize); }
7061

7162
// Comparison
7263
bool operator==(const CBuffer& other) const { return size() == other.size() && std::equal(begin(), end(), other.begin()); }
@@ -76,12 +67,6 @@ namespace SharedUtil
7667
// Status
7768
void SetSize(uint uiSize, bool bZeroPad = false)
7869
{
79-
#if defined(MTA_CLIENT) && defined(__cplusplus)
80-
CrashTelemetry::Scope telemetryScope(uiSize,
81-
this,
82-
"SharedUtil::CBuffer::SetSize",
83-
bZeroPad ? "ZeroPad" : "NoZeroPad");
84-
#endif
8570
uint uiOldSize = (uint)size();
8671
resize(uiSize);
8772
if (bZeroPad && uiSize > uiOldSize)

Shared/sdk/SharedUtil.Memory.hpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*****************************************************************************/
1010

1111
#include "SharedUtil.Memory.h"
12-
#include <mutex>
1312

1413
#ifdef _WIN32
1514
#include <Windows.h>
@@ -186,14 +185,11 @@ namespace SharedUtil
186185

187186
void SetMemoryAllocationFailureHandler()
188187
{
189-
static std::once_flag s_installOnce;
190-
std::call_once(s_installOnce, []() {
191188
#if defined(_WIN32)
192-
_set_new_handler(&HandleMemoryAllocationFailure);
193-
// _set_new_mode(1 /* call _set_new_handler for malloc failure */);
189+
_set_new_handler(&HandleMemoryAllocationFailure);
190+
// _set_new_mode(1 /* call _set_new_handler for malloc failure */);
194191
#else
195-
std::set_new_handler(&HandleMemoryAllocationFailure);
192+
std::set_new_handler(&HandleMemoryAllocationFailure);
196193
#endif
197-
});
198194
}
199195
} // namespace SharedUtil

0 commit comments

Comments
 (0)