Vixen
dd8b0a81
csharp
public sealed class BandwidthLedger

Where the bandwidth went.

Read the guide page for this →

Remarks

"What is eating my thirty kilobits" is the question, and it has four answers. Which component type, which field of it, which remote call, and which connection. A total is not an answer to any of them, and a profiler that only reports the total is one whose first use is to tell you that you need a better profiler.

Counted in bits, reported in bytes. Everything here is bit-packed, so rounding each record up to a byte before adding it up would invent up to seven bits per record — which on a snapshot of a dozen small records is most of the answer.

Off unless something attaches one. When attached the cost is a dictionary increment per record, which is the right side of the trade for a thing you want on when the bug happens — the same argument Vixen.Core.Diagnostics' profiler makes for itself. Per-object attribution is the exception and is separately opt-in, because it is the one whose table grows with the size of the world rather than with the number of component types.

Fields and properties (7)

  • public bool TrackObjects

    Whether to attribute to individual networked objects as well as to types.

  • public TimeSpan Elapsed

    How long has been accounted for, so the totals can be turned into a rate.

  • public long TotalBits

    Everything, in bits.

  • public long TotalCount

    How many records and calls that was.

  • public long DeltaCount

    Snapshot records sent as a difference.

  • public long WholeCount

    Snapshot records sent whole.

  • public double KilobitsPerSecond

    What the whole lot comes to, in kilobits a second.

Methods (10)

  • public void Advance(TimeSpan elapsed)

    Records the time a report covers, so its totals can be read as rates.

  • public void Record(PlayerId to, NetworkId of, string typeName, int bits, bool asDelta)

    Takes one replicated value.

  • public void RecordFields(string typeName, ReadOnlySpan<WireLane> lanes, ReadOnlySpan<int> costs)

    Takes what each field of a value cost, within a record already recorded.

  • public void RecordCall(PlayerId with, string method, int bits)

    Takes one remote call.

  • public IReadOnlyList<BandwidthEntry> TopComponents(int count = 10)

    The most expensive component types.

  • public IReadOnlyList<BandwidthEntry> TopFields(int count = 10)

    The most expensive fields, across every component.

  • public IReadOnlyList<BandwidthEntry> TopCalls(int count = 10)

    The most expensive remote calls.

  • public IReadOnlyList<BandwidthEntry> TopObjects(int count = 10)

    The most expensive networked objects. Empty unless TrackObjects.

  • public IReadOnlyList<BandwidthEntry> TopConnections(int count = 10)

    What each connection has been sent.

  • public void Reset()

    Forgets everything, for a report over the next stretch rather than the whole run.

Used by (13)

  • GameServerMultiplayer
  • LocalMatchMultiplayer
  • SoakNetworkSoak
  • DiagnosticsTestsVixen.Net.Tests
  • NetworkMetricsVixen.Net
  • NetworkMetricsTestsVixen.Net.Tests
  • ReplicationServerVixen.Net
  • RpcRouterVixen.Net
  • DiagnosticsModuleVixen.Editor.Diagnostics
  • NetworkReportVixen.Editor.Debugger
  • NetworkViewVixen.Editor.Debugger
  • NetworkViewTestsVixen.Editor.Debugger.Tests
  • RealmMetricsTestsVixen.Live.Realm.Tests