1
- Unity Bindings for Mobile Studio
2
- ================================
1
+ Unity Bindings for Performance Studio
2
+ =====================================
3
3
4
4
Introduction
5
5
------------
6
6
7
7
This package contains C# bindings needed to export application-generated
8
- counters and event annotations to the Mobile Studio Streamline profiler.
8
+ counters and event annotations to the Performance Studio Streamline profiler.
9
9
10
10
The Streamline profiler can collect and present application software profiling
11
11
information alongside sample-based hardware performance counter data from both
12
12
Arm CPUs and GPUs. Streamline has an * annotations* feature which allows the
13
13
application being profiled to emit additional information that can be displayed
14
14
alongside the other captured performance information.
15
15
16
+ > ** Note:** Performance Studio was formerly known as Mobile Studio. For API
17
+ > backwards compatibility the package continues to use the ` MobileStudio ` file
18
+ > name prefix and C# namespace.
19
+
16
20
Installation
17
21
------------
18
22
19
23
1 ) Open the package manager in Unity.
20
24
2 ) Click ` + ` in the toolbar and select ` Add package from git URL ` .
21
- 3 ) Import the Mobile Studio package from GitHub into your project.
25
+ 3 ) Import the Performance Studio package from GitHub into your project.
22
26
23
27
It is recommended that you set up a define so you can easily remove the
24
28
package from release builds without leaving errors in your code from package
25
29
usage. To set up the define, follow these steps:
26
30
27
- 4 ) If you do not have an asmdef file for scripts that reference the Mobile
28
- Studio API, create one.
31
+ 4 ) If you do not have an asmdef file for scripts that reference the package
32
+ API, create one.
29
33
5 ) In the asmdef file, under ` Assembly Definition References ` ,
30
34
add ` MobileStudio.Runtime ` .
31
35
6 ) In the asmdef file, under ` Version Defines ` , add a rule:
@@ -34,7 +38,7 @@ usage. To set up the define, follow these steps:
34
38
c) Set ` Expression ` to ` 1.0.0 `
35
39
This rule makes Unity define ` MOBILE_STUDIO ` if the ` com.arm.mobile-studio `
36
40
package is present in the project and if its version is greater than ` 1.0.0 ` .
37
- 7 ) In your code, wrap ` MOBILE_STUDIO ` around the Mobile Studio API:
41
+ 7 ) In your code, wrap ` MOBILE_STUDIO ` around the package API use :
38
42
39
43
#if MOBILE_STUDIO
40
44
// Package usage
@@ -48,72 +52,75 @@ Usage
48
52
49
53
### Markers
50
54
51
- The simplest annotations are markers. To use them in a project into which you
52
- have included this package, simply call into the Mobile Studio library as
53
- follows:
55
+ Markers are the simplest annotations, emitting a timestamped point indicator
56
+ that will be shown along the top of the Streamline timeline view.
54
57
55
- MobileStudio.Annotations.marker("Frame");
58
+ To emit a marker, e.g:
56
59
57
- This will emit a timestamped marker with the label "Frame", which Streamline
58
- will show along the top of the timeline.
60
+ MobileStudio.Annotations.marker("Frame");
59
61
60
- You can also specify the color of the marker by passing an optional Color
61
- object, such as :
62
+ You can also specify the color of the marker by passing an optional Unity
63
+ ` Color ` object, e.g :
62
64
63
65
MobileStudio.Annotations.marker("Frame", Color.green);
64
66
65
67
### Channels
66
68
67
- Channels are custom event timelines associated with a software thread. When a
68
- channel has been created, you can place annotations within it. A channel
69
- annotation has a text label and a color but, unlike markers, they span a range
70
- of time.
69
+ Channels are custom event swimlanes that are associated with a software thread
70
+ in the Streamline timeline. Once a channel has been created, you can place
71
+ job annotations within it. A channel job annotation has a text label and a
72
+ color but, unlike markers, they span a range of time.
71
73
72
- To create a channel:
74
+ To create a channel, e.g. :
73
75
74
76
channel = new MobileStudio.Annotations.Channel("AI");
75
77
76
- Annotations can be inserted into a channel easily :
78
+ To insert an annotation time-box into the channel, e.g. :
77
79
80
+ // Trigger the start of the annotation
78
81
channel.annotate("NPC AI", Color.red);
79
- // Do work ...
82
+
83
+ // Do the work you want to time ...
84
+
85
+ // Trigger the end of the annotation
80
86
channel.end();
81
87
82
88
### Counters
83
89
84
- Counters are numerical data points that can be plotted as a chart in the
90
+ Counters are numerical data points that can be plotted as a chart series in the
85
91
Streamline timeline view. Counters can be created as either absolute counters,
86
92
where every value is an absolute value, or as a delta counter, where values are
87
93
the number of instances of an event since the last value was emitted. All
88
94
values are floats and will be presented to 2 decimal places.
89
95
90
- When charts are first defined the user can specify two strings, a title and
91
- series name. The title names the chart, the series names the data series.
92
- Multiple counter series can use the same title, which means that they will be
93
- plotted on the same chart in the Streamline timeline.
96
+ When charts are first defined you can specify a title and a series name. The
97
+ title names the chart, the series names the data series. Multiple counter
98
+ series can use the same title, which means that they will be plotted on the
99
+ same chart in the Streamline timeline.
94
100
95
101
To create a counter, e.g.:
96
102
97
103
counter = new MobileStudio.Annotations.Counter(
98
104
"Title", "Series", MobileStudio.Annotations.CounterType.Absolute);
99
105
100
- Counter values are set easily :
106
+ To set a value for a counter, e.g. :
101
107
102
108
counter.setValue(42.2f);
103
109
104
110
### Custom Activity Maps
105
111
106
- Custom Activity Map (CAM) views allow execution information to be plotted on
107
- a hierarchical set of timelines. Like channel annotations, CAM views plot Jobs
108
- on tracks, but unlike channel annotations, CAM views are not associated with a
109
- specific thread. CAM Jobs can also be linked by dependency lines, allowing
110
- control flow between them to be visualized.
112
+ Custom Activity Map (CAM) views allow job execution information to be plotted
113
+ on a hierarchical set of swimlane tracks. Each CAM view defines a standalone
114
+ visualization and, unlike channel annotations, tracks are not associated with
115
+ with a specific calling thread. Dependency information between jobs within a
116
+ single CAM view can also be defined, allowing the visualization to show
117
+ control flow information if it is provided.
111
118
112
- To create a CAM view:
119
+ To create a CAM view, e.g :
113
120
114
121
gameCAM = new MobileStudio.Annotations.CAM("Game Activity");
115
122
116
- To add tracks to the CAM:
123
+ To add tracks to the CAM, e.g :
117
124
118
125
// Create root tracks in the view
119
126
aiTrack = gameCAM.createTrack("AI activity");
@@ -154,11 +161,15 @@ Streamline visualization.
154
161
Further Reading
155
162
---------------
156
163
157
- If you'd like to know more or raise any questions, please see the Mobile Studio
158
- developer pages at:
164
+ If you'd like to know more or raise any questions, please see the Performance
165
+ Studio developer pages at:
166
+
167
+ * https://developer.arm.com/performance-studio
168
+
169
+ Community support is available from Arm's graphics forum at:
159
170
160
- * https://developer .arm.com/mobile-studio
171
+ * https://community .arm.com/graphics
161
172
162
- Community support is available from Arm's Graphics and Multimedia forum at:
173
+ - - -
163
174
164
- * https://community.arm.com/support-forums/f/graphics-gaming- and-vr-forum
175
+ _ Copyright © 2021-2024, Arm Limited and contributors. All rights reserve
0 commit comments