GameSparks Profiler
The GameSparks Profiler allows you to collect and inspect performance metrics for your Cloud Code. When you enable the GameSparks Profiler, you can view a range of performance metrics for any Cloud Code that is invoked - directly or indirectly - when you run the Event, Request, Response, or Message:
- For example, you might have attached some Cloud Code to the AuthenticationResponse. If you then submit an AuthenticationRequest, this Cloud Code will be executed when the response is returned and profile data for that Cloud Code will be available to be viewed.
- However, if you have no Cloud Code attached to either the AuthenticationRequest or the AuthenticationResponse, then no profile data will be available to be viewed when you submit the AuthenticationRequest.
By inspecting and analyzing these profile performance metrics, you can quickly identify and address performance issues that arise for any of the Cloud Code you've built into your game.
Identifying Performance Issues? You can identify performance issues with calls you are making into the platform in the first instance by using the API Stream Analytics data tool. See this page for details of how to do this.
Enabling the Profiler
To enable profiling for Cloud Code, in the Debug section of the Test Harness select the Profile checkbox:
Debug Disabled! When you enable the Profiler, the Debugger is disabled and any Cloud Code that runs for an Event, Request, Response, or Message will be run without the Debugger showing.
Working with the Profiler
With the Profiler enabled, when you run an Event or submit a Request that has Cloud Code directly attached to it or indirectly associated with it - perhaps attached to a Response or Message that is invoked - profile data for performance of the Cloud Code is gathered. You can then view and analyze these performance profile data, allowing you to identify and remedy any performance issues with that Cloud Code.
The performance profile metrics and how to view them are explained in the context of the following Cloud Code profiling example.
Cloud Code Profiling Example
In this example:
- We enable profiling in the Test Harness.
- Submit a LOAD_PLAYER Event that has Cloud Code attached:
- View the performance profile for the Cloud Code it executes.
1. Open the Test Harness and in the Debug panel select the Profile checkbox. Note that the checkboxes for Debug mode are grayed out.
2. Authenticate for a player that's already registered for your game.
3. Select the Event or Request whose Cloud Code you want to profile - here we'll select the LOAD_PLAYER Event under Log Event.
4. Under JSON click Send Request.
5. In the Inspector, click View Profile:
The Profile panel opens for the Cloud Code that's been executed:
Note that:
- For Metric, the default performance metric shown is for execution time in milliseconds.
- Mongo or Redis queries are represented as functions to allow you to identify performance-costly queries.
6. Use the Metric drop-down to select another performance metric:
- Number of Statements: