diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp b/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp index 724d91e3ccb..2153e5e8e7c 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp @@ -6,9 +6,9 @@ */ #include -#include #include +#include #include #include #include @@ -739,6 +739,15 @@ jsi::Value JavaTurboModule::invokeJavaMethod( moduleNameStr = name_, methodNameStr, id = getUniqueId()]() mutable { + SystraceSection s( + "JavaTurboModuleAsyncMethodInvocation", + "module", + moduleNameStr, + "method", + methodNameStr, + "returnType", + "void"); + auto instance = instance_.lockLocal(); if (!instance) { return; @@ -822,6 +831,15 @@ jsi::Value JavaTurboModule::invokeJavaMethod( moduleNameStr = name_, methodNameStr, id = getUniqueId()]() mutable { + SystraceSection s( + "JavaTurboModuleAsyncMethodInvocation", + "module", + moduleNameStr, + "method", + methodNameStr, + "returnType", + "promise"); + auto instance = instance_.lockLocal(); if (!instance) { return; diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm index 8caecfb664b..ff46972196f 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm @@ -8,7 +8,8 @@ #import "RCTTurboModule.h" #import "RCTBlockGuard.h" -#include +#import +#import #import #import #import @@ -425,7 +426,17 @@ id ObjCTurboModule::performMethodInvocation( } else { asyncCallCounter = getUniqueId(); TurboModulePerfLogger::asyncMethodCallDispatch(moduleName, methodName); - nativeMethodCallInvoker_->invokeAsync(methodNameStr, [block]() -> void { block(); }); + nativeMethodCallInvoker_->invokeAsync(methodNameStr, [block, moduleName, methodNameStr]() -> void { + SystraceSection s( + "RCTTurboModuleAsyncMethodInvocation", + "module", + moduleName, + "method", + methodNameStr, + "returnType", + "promise"); + block(); + }); return nil; } } @@ -475,7 +486,11 @@ void ObjCTurboModule::performVoidMethodInvocation( } else { asyncCallCounter = getUniqueId(); TurboModulePerfLogger::asyncMethodCallDispatch(moduleName, methodName); - nativeMethodCallInvoker_->invokeAsync(methodNameStr, [block]() -> void { block(); }); + nativeMethodCallInvoker_->invokeAsync(methodNameStr, [moduleName, methodNameStr, block]() -> void { + SystraceSection s( + "RCTTurboModuleAsyncMethodInvocation", "module", moduleName, "method", methodNameStr, "returnType", "void"); + block(); + }); } }