You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/mobile-graphics-and-gaming/profiling-unity-apps-on-android/2-preparation.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ Once Unity has loaded, you will be presented with a template project. You can ig
71
71
72
72
13. The Import Unity Package window will appear. It allows individual files and folders to be imported or ignored. You will need all of the files in the project. Leave all items ticked and select _Next_.
73
73
74
-

74
+

75
75
76
76
14. A second window will open listing the project settings that will be overwritten. You want the settings from the sample project, so leave all items ticked and select _Import_.
77
77
@@ -86,15 +86,15 @@ Once the sample project has been imported, you will see some errors and warnings
86
86
87
87
3. Select _Switch Platform_, as you did in the [previous Learning Path](/learning-paths/mobile-graphics-and-gaming/get-started-with-unity-on-android/3-test-on-android/)
Unity will take a moment to build the assets for the Android platform.
92
92
93
93
The errors will disappear, but some warnings regarding unreachable code may appear. These will be explained later and can be safely ignored for now.
94
94
95
95
Your Scene view should look something like this:
96
96
97
-

97
+

98
98
99
99
If it does not, the next steps should help identify the issue.
100
100
@@ -117,7 +117,7 @@ It is worth checking that everything has been imported and built correctly.
117
117
118
118
The game will launch, and you will see an empty environment begin to fill with more and more characters (capsules) over time. It will look something like this:
119
119
120
-

120
+

121
121
122
122
## Deploy to Android
123
123
You will now deploy the sample to your Android device. Your device must already be set up for development. For detailed instructions, read the learning path [Get started with Unity on Android](/learning-paths/mobile-graphics-and-gaming/get-started-with-unity-on-android).
Copy file name to clipboardExpand all lines: content/learning-paths/mobile-graphics-and-gaming/profiling-unity-apps-on-android/4-profiling.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ The Profiler window contains a lot of information spread over two main scrollabl
71
71
### CPU Usage graph and frame-rate labels
72
72
The CPU Usage graph captures profiling data every frame while it is active.
73
73
74
-

74
+

75
75
76
76
If you have a performance issue that worsens over time (as with the case of the collision sample), you will see the graph gradually (or quickly) fill over time. Watch the frame rate labels on the left of the graph. These labels mark the Y-axis at set intervals. They show you what CPU Usage would be required to achieve given frame rates. For example, if your CPU Usage remained under 16 milliseconds then as far as the CPU is concerned, a frame rate of 60 frames-per-second (FPS) would be achievable. If the CPU Usage is under 16ms but your frame rate is still lower than expected, that is an indication that the app has performance issues elsewhere, e.g., in the GPU.
77
77
@@ -83,7 +83,7 @@ The CPU Usage graph provides a very high level view of what is happening in the
83
83
84
84
The peaks on the CPU Usage graph tell you where there are particularly high loads. Ensure that the drop-down menu in the lower panel is showing Timeline. Select a frame on your graph where there is a peak or any frame that looks as if it took more time than it should (in this case, all frames look suitable).
The lower panel will show activity from the selected frame. The rows show main thread, render thread, job worker threads (expand Job entry to see the workers and what tasks they performed) and several other areas and job types. The colors of the boxes match those of the categories listed in the CPU Usage panel.
89
89
@@ -99,7 +99,7 @@ The PlayerLoop entry on the main thread is an internal Unity engine function, th
99
99
100
100
Staying in the lower panel, select the drop-down menu currently labeled Timeline. Change it to Hierarchy mode. You will now see a Hierarchy of functions and profiled areas. Expand the Hierarchy to show *PlayerLoop/Update.ScriptRunBehaviourUpdate/BehaviourUpdate*.
101
101
102
-

102
+

103
103
104
104
Under BehaviourUpdate, you will see the custom script `CollisionCalculationScript.Update`. If you look across to the right, you will see information about the calls to this function. Under the Total column below you will see that the `CollisionCalculationScript Update()` function took 66.4% of the total of PlayerLoop. Expand `CollisionCalculationScript` to drill down even further.
105
105
@@ -113,7 +113,7 @@ The Deep Profile option tells the Profiler to collect much more performance data
113
113
114
114
In addition to performance timings, you can also see how often memory allocations are made. The Call Stacks option enables recording of such memory allocations. It is accompanied by a pull-down menu with three options, _GC.Alloc_ is the default. You can see when your code triggers a memory allocation. Click on the GC.Alloc block (in magenta) to see the call stack in the pop-up window.
115
115
116
-

116
+

- The Mode can be switched between _Single_ (view a single data set) and _Compare_ (compare two frames from the same or different data sets)
47
47
@@ -93,7 +93,7 @@ You can also reduce the data analysis to a specific range of frames.
93
93
94
94
6. Hover your mouse over the selected frames in the graph to see a pop-up summary. The pop-up will tell you the frame duration of the exact frame you are hovering over and also the total time of the selected frames.
95
95
96
-

96
+

97
97
98
98
You can see from the Marker Details table, the function _CollisionCalculationScript.Update_ is high in the list.
99
99
@@ -115,7 +115,7 @@ The collision sample is unlikely to be GPU bound but here's how to tell using th
115
115
116
116
- In the case of the collision sample, the median is zero. Under _Marker Summary_ you can see the min and max values are also both zero. The sample never seems to be waiting for the GPU.
117
117
118
-
 for the GPU.")
118
+
 for the GPU.")
119
119
120
120
### Performance data for specific functions or markers
121
121
@@ -127,7 +127,7 @@ Select multiple frames again by left-clicking and dragging on the graph.
127
127
128
128
You have seen already that the collision detection script is taking a significant amount of the total frame time. In the Name Filter enter “collision” to reduce the Marker Details table.
129
129
130
-

130
+

131
131
132
132
You can now see data for functions and markers with “collision” in their name.
133
133
@@ -173,7 +173,7 @@ Keep the unoptimized data in the Analyzer. Leave the Name Filter set to “colli
173
173
174
174
You are now looking at the unoptimized (upper graph) and optimized (lower graph) data.
175
175
176
-

176
+

177
177
178
178
### Graph selection
179
179
Each graph can have a range of frames selected. If you want to ensure that you select the same frames from both graphs, tick the option _Pair Graph Selection_. Do this now. When you click on a specific frame in either graph, the same frame will be selected in the other graph automatically.
@@ -185,7 +185,7 @@ You are now comparing the first 300 frames of each data set.
185
185
### Comparing the two data sets
186
186
You will notice immediately a difference in the _Top 10 markers on median frames_ area. You can see the difference between the two median frames in the screenshot below. The upper frame duration is 87.7ms while the lower frame is 33.4ms (these numbers are to the right of the colored entries). The size of each marker/function for the optimized set are all reduced compared to the unoptimized version. This is as expected since the optimizations will have reduced how long each of those operations takes.
187
187
188
-

188
+

189
189
190
190
In the Marker Details table (now labeled Marker Comparison) you will see that there are new columns. Left Median, Right Median and two columns marked "<" and ">". The "left" dataset is the unoptimized code, the right is the optimized code. The Diff and Abs Diff columns give you the numerical difference (and absolute difference) between each function/marker.
0 commit comments