/com.besthttp.profiler

View internal statistics related to the Best HTTP/2 plugin, integrated into the Unity Profiler window.

Primary LanguageC#MIT LicenseMIT

Best HTTP/2 Profiler

View internal statistics related to the Best HTTP/2 plugin, integrated into the Unity Profiler window.

Installation

Steps to install and setup:

  1. The profiler addon has a dependency on the com.unity.profiling.core that requires Unity 2021.2 or newer installations.

  2. Make sure that the Best HTTP/2 package is already installed.

  3. Using the Package Manager window install the package from the following git source: https://github.com/Benedicht/com.besthttp.profiler.git:

    Add Package from Git URL

  4. Create a new GameObject in your scene and add the DataCollector component:

    DataCollector GameObject

📝 Note: DataCollector will call Object.DontDestroyOnLoad on the GameObject it's placed on!

Network Profiler

Network profiler overview

Collected fields:

  • Sent: Sent bytes since the previous frame.
  • Sent Total: Total bytes sent by the plugin.
  • Received: Received bytes since the previous frame.
  • Received Total: Total bytes received.
  • Open Connections: Currently open connections. An open connection might be an idle connection that have no active request/response to process.
  • Total Connections: Total connections, including open ones too.

📝 Note: Communication with a proxy isn't tracked by the Network Profiler until it's connected. This means that while it tries to connect it doesn't show up in Open Connections and Total Connections, negotiation request and response doesn't registered in Sent/Sent Total/Received/Received Total.

Memory Profiler

Memory profiler overview

Collected fields:

  • Borrowed: Borrowed memory from the BufferPool.
  • Pooled: Memory in the BufferPool available to borrow.
  • Array Allocations: Total number of byte[] allocations through the BufferPool. An allocation occurs when there's no suitable byte[] in the pool to borrow. If it's constantly growing, increasing BufferPool.MaxPoolSize might be a good idea.

📝 Note: In case of errors memory might not be placed back to the pool and will be displayed as borrowed indefinitely. It doesn't mean there's a memory leak, just that it doesn't placed back to the BufferPool.

Data Collection

There are two ways to collect data for the profiler. The first one is to use the DataCollector component attached to a GameObject. The seconds method is to use the ProfilerUpdater directly from code. ProfilerUpdater.Attach() can be used to start collecting, its best place is somewhere in a startup code before any other plugin releated calls. ProfilerUpdater.Detach() can be used to stop data collection.