Where does the Profiler Window Go?

I’m trying to trap a runaway Paint event, so I enable “Project” -> “Profile Code”. After running the app, I see the results in a new window. I open one of the entries and double click the caller and I’m taken to the place in the code as expected. HOWEVER, the Profile result window is now gone - POOF!

Is this “as designed” or a bug?

Profiles appear in the navigator

Even more frustrating - the Profiler Result window doesn’t even show up on macOS 10.14. Yes, I have made sure that the app is exiting cleanly.

I just discovered that on Linux.

Also, just realized that the IDE on macOS was not logged in, so it had no license.

Maybe disable that menu option since it doesn’t run in profile mode unless you have a license installed?

Nope - even properly logged in and licensed, the Profile results are not shown on macOS in 2018r3.

Does it work for an empty app?

It does work for an empty app.

Since this app is one that exhibits the need for the macOS terminate hack to prevent the app from triggering the macOS Crash Reporter when it exits, would that also relate to the profiler seeing a bad exit? I don’t get Profiler results with the terminate hack enabled or disabled.

It would be helpful to see exactly what code you are calling to terminate your app… but if it’s simply killing the app without letting the app quit on its own, then yes, it could certainly cause profiling to fail. It relies on class destructors to fire for the final wrap-up code to run.

In debug mode, I call “Quit”. In release mode, I call the terminate hack:

[code]//exit the process
If TargetMacOS And Not DebugBuild
Declare Function NSClassFromString Lib “Cocoa” (aClassName As CFStringRef) As Integer
Declare Function sharedApplication Lib “Cocoa” Selector “sharedApplication” (classRef As Integer) As Integer
Declare Sub terminate Lib “Cocoa” Selector “terminate:” (appRef As Integer, sender As Integer)

Dim appInstance As Integer = sharedApplication(NSClassFromString(“NSApplication”))
terminate(appInstance, appInstance)
Else
Quit
End If[/code]

Where is that code?

You could use #if there.

I think it was in 2018r2 that StartProfiling and StopProfiling were added. See http://documentation.xojo.com/resources/release_notes/2018r2.html .

Sorry, that is in App.Close.

I have tried it with both #if and Normal If - same result.

Good point - I’ll try adding StartProfiling in the App.Open amd StopProfiling before the terminate call in App.Close to see it that sorts it.

StopProfiling should work because I have to use the declare, too.

Still no profile results.

Added StartProfiling to App.Open and added StopProfiling in App.Close as the first call. Also added a Beep to make sure that the App.Close is what was causing the app to quit.

Get the beep, but no profiling results.

If you use this declare understand that it effectively behaves like a KILL of the process. Nothing in the app is destroyed properly - the process is simply terminated and no destructors run - not even those in the framework.

[quote=413926:@Tim Jones]Still no profile results.

Added StartProfiling to App.Open and added StopProfiling in App.Close as the first call. Also added a Beep to make sure that the App.Close is what was causing the app to quit.

Get the beep, but no profiling results.[/quote]

You still have to turn profiling on for these methods to do anything otherwise the underlying code they require is not enabled.

I did

I’ve now removed all instances of the terminate hack, and still no profile output. I have one other project that does show the Profiler output and two that don’t. All four profile properly on Linux.

@Jason Parsley : you fix this bug <https://xojo.com/issue/48395> here and then I can remove the declare. My app doesn’t quit at all in 64bit. And this affects the build, too, not only debug.

I see that 48395 is for release 2017r1.1.

Does it work for you in 2018r3? We tried 2018r3 and it quits as expected.