Class DpsWindow
- Namespace
- SurvivorsMaker.Presentation
- Assembly
- SurvivorsMaker.Presentation.dll
Sliding sum over the last WindowTicks ticks per key: one bucket per tick in a ring, so adding is O(1) and nothing is allocated after a key is first seen. Rates divide by the window, or by the ticks since StartTick while fewer have passed (so the first second of a wave is not under-reported).
public sealed class DpsWindow
- Inheritance
-
DpsWindow
- Inherited Members
Constructors
DpsWindow(int)
public DpsWindow(int windowTicks)
Parameters
windowTicksint
Properties
Keys
Keys in the order first seen.
public IReadOnlyList<int> Keys { get; }
Property Value
StartTick
public int StartTick { get; }
Property Value
WindowTicks
public int WindowTicks { get; }
Property Value
Methods
Add(int, int, float)
public void Add(int tick, int key, float amount)
Parameters
PerSecond(float, int, float)
public float PerSecond(float sum, int nowTick, float tickSeconds)
Parameters
Returns
Rate(int, int, float)
public float Rate(int key, int nowTick, float tickSeconds)
Parameters
Returns
Reset(int)
Forgets every amount; keys stay known. Ticks before startTick are never counted.
public void Reset(int startTick)
Parameters
startTickint
Share(int, int)
Fraction 0–1 of the window's total that came from key.
public float Share(int key, int nowTick)
Parameters
Returns
SpanTicks(int)
Ticks the rate is measured over: the window, or fewer at the start.
public int SpanTicks(int nowTick)
Parameters
nowTickint
Returns
Sum(int, int)
Amount added for key in the window ending at nowTick (inclusive).
public float Sum(int key, int nowTick)
Parameters
Returns
Total(int)
public float Total(int nowTick)
Parameters
nowTickint
Returns
TotalRate(int, float)
public float TotalRate(int nowTick, float tickSeconds)