Skip to content

Commit 4499154

Browse files
committed
Added scope for callExtensionArgs
1 parent cfbebc6 commit 4499154

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/scriptProfiler.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,34 @@ game_value callExtensionRedirect(game_state&, game_value_parameter ext, game_val
771771
return res;
772772
}
773773

774+
game_value callExtensionArgsRedirect(game_state&, game_value_parameter ext, game_value_parameter msg) {
775+
if (!profiler.callExtScope) {
776+
static r_string compileEventText("callExtension");
777+
static r_string profName("scriptProfiler.cpp");
778+
profiler.callExtScope = GProfilerAdapter->createScope(compileEventText, profName, __LINE__);
779+
}
780+
781+
auto tempData = GProfilerAdapter->enterScope(profiler.callExtScope);
782+
783+
//GProfilerAdapter->setDescription(tempData, msg);
784+
785+
auto res = host::functions.invoke_raw_binary(__sqf::binary__callextension__string__array__ret__array, ext, msg);
786+
787+
788+
#ifdef WITH_BROFILER
789+
if (auto brofilerData = std::dynamic_pointer_cast<ScopeTempStorageBrofiler>(tempData)) {
790+
brofilerData->evtDt->thisArgs = ext;
791+
brofilerData->evtDt->sourceCode = msg;
792+
}
793+
#endif
794+
795+
GProfilerAdapter->leaveScope(tempData);
796+
797+
return res;
798+
}
799+
800+
801+
774802
game_value diag_logRedirect(game_state&, game_value_parameter msg) {
775803
r_string str = static_cast<r_string>(msg);
776804

@@ -1224,6 +1252,7 @@ void scriptProfiler::preStart() {
12241252
static auto _profilerCompileF = client::host::register_sqf_command("compileFinal", "Profiler redirect", compileRedirectFinal, game_data_type::CODE, game_data_type::STRING);
12251253
};
12261254
static auto _profilerCallExt = client::host::register_sqf_command("callExtension", "Profiler redirect", callExtensionRedirect, game_data_type::STRING, game_data_type::STRING, game_data_type::STRING);
1255+
static auto _profilerCallExtArgs = client::host::register_sqf_command("callExtension", "Profiler redirect", callExtensionArgsRedirect, game_data_type::STRING, game_data_type::STRING, game_data_type::ARRAY);
12271256
static auto _profilerDiagLog = client::host::register_sqf_command("diag_log", "Profiler redirect", diag_logRedirect, game_data_type::NOTHING, game_data_type::ANY);
12281257
static auto _profilerProfScript = client::host::register_sqf_command("profileScript", "Profiler redirect", profileScript, game_data_type::ARRAY, game_data_type::ARRAY);
12291258
if (!compHookDisabled) {

0 commit comments

Comments
 (0)