Add some important profiling hooks.

This commit is contained in:
Lukas Tenbrink
2025-04-01 19:00:57 +02:00
parent e80194e31f
commit c3747884da
14 changed files with 118 additions and 10 deletions

View File

@@ -34,6 +34,7 @@
#import "godot_window.h"
#import "key_mapping_macos.h"
#include "core/profiling/profiling.h"
#include "main/main.h"
@implementation GodotContentLayerDelegate
@@ -56,6 +57,9 @@
- (void)displayLayer:(CALayer *)layer {
DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton();
if (OS::get_singleton()->get_main_loop() && ds->get_is_resizing() && need_redraw) {
GodotProfileFrameMark;
GodotProfileZone("[GodotContentLayerDelegate displayLayer]");
Main::force_redraw();
if (!Main::is_iterating()) { // Avoid cyclic loop.
Main::iteration();

View File

@@ -1106,6 +1106,9 @@ void OS_MacOS_NSApp::start_main() {
pre_wait_observer = CFRunLoopObserverCreateWithHandler(kCFAllocatorDefault, kCFRunLoopBeforeWaiting, true, 0, ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
@autoreleasepool {
@try {
GodotProfileFrameMark;
GodotProfileZone("macOS main loop");
if (ds_mac) {
ds_mac->_process_events(false);
} else if (ds) {
@@ -1279,6 +1282,9 @@ void OS_MacOS_Embedded::run() {
while (true) {
@autoreleasepool {
@try {
GodotProfileFrameMark;
GodotProfileZone("macOS embedded main loop");
ds->process_events();
#ifdef SDL_ENABLED