Skip to content

Commit d1480b9

Browse files
committedSep 17, 2024
chore(client): update readme
1 parent def7a9e commit d1480b9

File tree

2 files changed

+70
-15
lines changed

2 files changed

+70
-15
lines changed
 

‎README.md

+70-13
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,110 @@ UnityPulse is a benchmarking tool designed to facilitate continuous performance
1616
### Prerequisites
1717

1818
- Unity 2020 or higher
19-
- Go 1.16+ (required for backend scripts)
20-
- Basic knowledge of Unity's performance profiling tools
19+
- Start and up back-end listeners on your server ([Server README](https://github.com/c1982/unitypulse/blob/main/src/Pulse.Server/README.md))
20+
2121

2222
### Installation
2323

2424
0. Open Unity Packer Manager
2525
1. Add package from git URL
2626
2. Enter this URL:
27+
2728
https://github.com/c1982/unitypulse.git?path=/src/Pulse.Unity/Assets/Scripts/Pulse
2829

2930
### Usage
3031

32+
Pulse automatically initialized when unity starts. You can start and stop Pulse by calling `UnityPulse.Instance.Start` and `UnityPulse.Instance.Stop` respectively. You can also collect custom data by calling `UnityPulse.Instance.Collect` with a key and value pair.
33+
34+
Basic usage example:
35+
3136
```csharp
32-
using Pulse;
37+
using Pulse.Unity;
3338
using UnityEngine;
34-
using Debug = UnityEngine.Debug;
3539

3640
namespace Example
3741
{
3842
public class ExampleController : MonoBehaviour
3943
{
40-
private UnityPulse _pulse;
41-
private readonly byte[] _updateTimeKeyName = System.Text.Encoding.UTF8.GetBytes("update_time");
44+
private readonly byte[] _updateTimeKeyName = System.Text.Encoding.ASCII.GetBytes("update_time");
4245
private long _updateTime;
4346

4447
public void Awake()
4548
{
46-
_pulse = UnityPulse.Instance.SetTargetFrameRate(Application.targetFrameRate);
49+
// Initialize Pulse
50+
UnityPulse.Instance
51+
.SetDefaultLogger()
52+
.SetIdentifier(Application.identifier)
53+
.SetPlatform(Application.platform.ToString())
54+
.SetVersion(Application.version)
55+
.SetDevice(SystemInfo.deviceName)
56+
.SetSendBufferSize(1024)
57+
.SetErrorThreshold(5)
58+
.SetInterval(1f);
4759
}
4860

4961
public void Start()
5062
{
51-
_pulse.Start("127.0.0.1",7771);
52-
Debug.Log("UnityPulse started");
63+
// Start Pulse
64+
UnityPulse.Instance.Start("127.0.0.1",7771);
5365
}
5466

5567
public void Update()
5668
{
57-
_pulse.Collect();
58-
_pulse.Collect(_updateTimeKeyName, Random.Range(1,100));
69+
// Collect Pulse data
70+
UnityPulse.Instance.Collect();
71+
72+
// Collect custom data
73+
UnityPulse.Instance.Collect(_updateTimeKeyName, Random.Range(1,100));
5974
}
6075

6176
public void OnDestroy()
6277
{
63-
_pulse.Stop();
64-
Debug.Log("UnityPulse stopped");
78+
UnityPulse.Instance.Stop();
6579
}
6680
}
6781
}
6882
```
83+
84+
### Collected Data
85+
86+
Pulse collects the following data:
87+
88+
#### Memory
89+
90+
- **System Used Memor**: The amount of memory used by the system.
91+
- **System Total Memory**: The total amount of memory available to the system.
92+
- **GC Used Memory**: The amount of memory used by the garbage collector.
93+
- **Audio Used Memory**: The amount of memory used by the audio system.
94+
- **Video Used Memory**: The amount of memory used by the video system.
95+
- **Profiler Used Memory**: The amount of memory used by the profiler.
96+
97+
#### Render
98+
99+
- **SetPass Calls Count**: The number of set pass calls.
100+
- **"Draw Calls Count"**: The number of draw calls.
101+
- **"Total Batches Count"**: The total number of batches.
102+
- **"Triangles Count"**: The number of triangles.
103+
- **"Vertices Count"**: The number of vertices.
104+
- **"Render Textures Count"**: The number of render textures.
105+
- **"Render Textures Bytes"**: The amount of memory used by render textures.
106+
- **"Render Textures Changes Count"**: The number of render texture changes.
107+
- **"Used Buffers Count"**: The number of used buffers.
108+
- **"Used Buffers Bytes"**: The amount of memory used by buffers.
109+
- **"Used Shaders Count"**: The number of used shaders.
110+
- **"Vertex Buffer Upload In Frame Count"**: The number of vertex buffer uploads.
111+
- **"Vertex Buffer Upload In Frame Bytes"**: The amount of memory used by vertex buffer uploads.
112+
- **"Index Buffer Upload In Frame Count"**: The number of index buffer uploads.
113+
- **"Index Buffer Upload In Frame Bytes"**: The amount of memory used by index buffer uploads.
114+
- **"Shadow Casters Count"**: The number of shadow casters.
115+
116+
### Grafana Dashboard
117+
118+
Pulse provides a Grafana dashboard to visualize the collected data. You can access the dashboard by navigating to `http://localhost:3000` in your browser and logging in with the default credentials:
119+
120+
- **Username**: pulse
121+
- **Password**: admin
122+
123+
Simple comparison between two sessions:
124+
125+
![Dashboard](./assets/dashboard-1.png)

‎src/Pulse.Unity/Assets/Scripts/Example/ExampleController.cs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ public void Awake()
1414
{
1515
Application.targetFrameRate = 60;
1616
InstantiateRandomCube();
17-
18-
UnityPulse.Instance.SetDefaultLogger();
1917
}
2018

2119
public void Start()

0 commit comments

Comments
 (0)
Please sign in to comment.