Skip to content

Commit 19fb5d6

Browse files
committed
Cleanup, Linux build fix
1 parent 914d23e commit 19fb5d6

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/EngineProfiling.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern "C" {
4343
void frameEnd();
4444
void compileCacheIns();
4545

46-
__declspec(noinline) void insertCompileCache(uintptr_t code, sourcedocpos& sdp) {
46+
void insertCompileCache(uintptr_t code, sourcedocpos& sdp) {
4747

4848
auto x = reinterpret_cast<ref<compact_array<ref<game_instruction>>>*>(code);
4949

@@ -63,6 +63,10 @@ extern "C" {
6363
bool PCounter::shouldTime() {
6464
if (slot < 0) return false;
6565

66+
if (GProfilerAdapter->getType() != AdapterType::Tracy) return false;
67+
auto tracyProf = std::dynamic_pointer_cast<AdapterTracy>(GProfilerAdapter);
68+
if (!tracyProf->isConnected()) return false;
69+
6670
if (mainThread && *mainThread != std::this_thread::get_id()) return false;
6771
//exclude security cat, evwfGet evGet and so on as they spam too much and aren't useful
6872
if (cat && cat[0] == 's' && cat[1] == 'e' && cat[2] == 'c' && cat[3] == 'u') return false;
@@ -72,13 +76,8 @@ bool PCounter::shouldTime() {
7276
if (cat && cat[0] == 'd' && cat[1] == 'd' && cat[2] == '1') return false; //dd11
7377
if (cat && cat[0] == 't' && cat[1] == 'e' && cat[2] == 'x' && cat[3] == 0) return false; //tex
7478
if (name && name[0] == 'I' && name[1] == 'G' && name[2] == 'S' && name[3] == 'M') return false; //IGSMM no idea what that is, but generates a lot of calls
75-
//Man update error. calltime is about constant and uninteresting
76-
if (name && name[0] == 'm' && name[1] == 'a' && name[2] == 'n' && name[3] == 'C') return false;
77-
78-
if (GProfilerAdapter->getType() != AdapterType::Tracy) return false;
79+
if (name && name[0] == 'm' && name[1] == 'a' && name[2] == 'n' && name[3] == 'C') return false; //Man update error. calltime is about constant and uninteresting
7980

80-
auto tracyProf = std::dynamic_pointer_cast<AdapterTracy>(GProfilerAdapter);
81-
if (!tracyProf->isConnected()) return false;
8281

8382

8483
std::shared_lock lock(scopeCacheMtx);
@@ -191,7 +190,9 @@ EngineProfiling::EngineProfiling() {
191190
hooks.placeHook(hookTypes::scopeCompleted, pat_scopeCompleted, reinterpret_cast<uintptr_t>(scopeCompleted), profEndJmpback, 0);
192191
hooks.placeHook(hookTypes::shouldTime, pat_shouldTime, reinterpret_cast<uintptr_t>(shouldTime), shouldTimeJmpback, 0);
193192
hooks.placeHook(hookTypes::frameEnd, pat_frameEnd, reinterpret_cast<uintptr_t>(frameEnd), frameEndJmpback, 0);
193+
#ifndef __linux__
194194
hooks.placeHook(hookTypes::compileCacheIns, pat_compileCacheIns, reinterpret_cast<uintptr_t>(compileCacheIns), compileCacheInsJmpback, 0);
195+
#endif
195196
#ifdef __linux__
196197
auto found = hooks.findPattern(pat_doEnd, 0);
197198

src/scriptProfiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ class GameInstructionNewExpression : public game_instruction {
10581058
#pragma endregion Instructions
10591059
#endif
10601060
void scriptProfiler::preStart() {
1061-
sqf::diag_log("preStart SP");
1061+
sqf::diag_log("Arma Script Profiler preStart");
10621062
if (getCommandLineParam("-profilerEnableInstruction"sv)) {
10631063
sqf::diag_log("ASP: Instruction Level profiling enabled"sv);
10641064
instructionLevelProfiling = true;

0 commit comments

Comments
 (0)