less perf fail in jams

This commit is contained in:
Chris Forbes
2009-11-06 23:12:24 +13:00
parent c174e65437
commit 701adda6f3
4 changed files with 56 additions and 32 deletions

View File

@@ -13,7 +13,7 @@ namespace OpenRa.Game.Support
static readonly Color[] colors = { Color.Red, Color.Green, Color.Blue, Color.Yellow, Color.Orange, Color.Fuchsia, Color.Lime, Color.LightBlue };
static int nextColor;
static Cache<string, PerfItem> items = new Cache<string, PerfItem>(
public static Cache<string, PerfItem> items = new Cache<string, PerfItem>(
s =>
{
var x = new PerfItem(s, colors[nextColor++]);
@@ -90,6 +90,16 @@ namespace OpenRa.Game.Support
yield return samples[n];
}
}
public double LastValue
{
get
{
int n = head;
if (--n < 0) n = samples.Length - 1;
return samples[n];
}
}
}
class PerfSample : IDisposable