Skip to content

Commit de55559

Browse files
authored
Plot throughput charts with integer thread count (#507)
1 parent a58a77b commit de55559

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

BitFaster.Caching.ThroughputAnalysis/CacheFactory.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public FastConcurrentLruFactory(int capacity)
2525
this.capacity = capacity;
2626
}
2727

28-
public string Name => "FsTConcLRU";
28+
public string Name => "FastConcurrentLru";
2929

3030
public DataRow DataRow { get; set; }
3131

@@ -46,7 +46,7 @@ public ConcurrentLruFactory(int capacity)
4646
this.capacity = capacity;
4747
}
4848

49-
public string Name => "ConcurrLRU";
49+
public string Name => "ConcurrentLru";
5050

5151
public DataRow DataRow { get; set; }
5252

@@ -67,7 +67,7 @@ public MemoryCacheFactory(int capacity)
6767
this.capacity = capacity;
6868
}
6969

70-
public string Name => "MemryCache";
70+
public string Name => "MemoryCache";
7171

7272
public DataRow DataRow { get; set; }
7373

@@ -88,7 +88,7 @@ public ConcurrentLfuFactory(int capacity)
8888
this.capacity = capacity;
8989
}
9090

91-
public string Name => "ConcurrLFU";
91+
public string Name => "ConcurrentLfu";
9292

9393
public DataRow DataRow { get; set; }
9494

BitFaster.Caching.ThroughputAnalysis/Exporter.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public void ExportCsv(Mode mode, int cacheSize)
7373

7474
public void ExportPlot(Mode mode, int cacheSize)
7575
{
76-
var columns = new List<string>();
76+
var columns = new List<int>();
7777

7878
for(int i = 1; i < resultTable.Columns.Count; i++)
7979
{
80-
columns.Add(resultTable.Columns[i].ColumnName);
80+
columns.Add(int.Parse(resultTable.Columns[i].ColumnName));
8181
}
8282

8383
List<GenericChart.GenericChart> charts = new List<GenericChart.GenericChart>();
@@ -91,7 +91,7 @@ public void ExportPlot(Mode mode, int cacheSize)
9191
rowData.Add(double.Parse(row[i].ToString()) * 1_000_000);
9292
}
9393

94-
var chart = Chart.Line<string, double, string>(columns, rowData, Name: name, MarkerColor: MapColor(name));
94+
var chart = Chart.Line<int, double, string>(columns, rowData, Name: name, MarkerColor: MapColor(name));
9595
charts.Add(chart);
9696

9797
var combined = Chart.Combine(charts);
@@ -109,13 +109,13 @@ public string MapTitle(Mode mode, int cacheSize)
109109
switch (mode)
110110
{
111111
case Mode.Read:
112-
return $"Read throughput (100% cache hit) for size {cacheSize}";
112+
return $"Read throughput (100% cache hit)";
113113
case Mode.ReadWrite:
114-
return $"Read + Write throughput for size {cacheSize}";
114+
return $"Read + Write throughput";
115115
case Mode.Update:
116-
return $"Update throughput for size {cacheSize}";
116+
return $"Update throughput";
117117
case Mode.Evict:
118-
return $"Eviction throughput (100% cache miss) for size {cacheSize}";
118+
return $"Eviction throughput (100% cache miss)";
119119
default:
120120
return $"{mode} {cacheSize}";
121121
}
@@ -127,13 +127,13 @@ public Color MapColor(string name)
127127
{
128128
case "ClassicLru":
129129
return Plotly.NET.Color.fromKeyword(Plotly.NET.ColorKeyword.Limegreen);
130-
case "MemryCache":
130+
case "MemoryCache":
131131
return Plotly.NET.Color.fromKeyword(Plotly.NET.ColorKeyword.FireBrick);
132-
case "FsTConcLRU":
132+
case "FastConcurrentLru":
133133
return Plotly.NET.Color.fromKeyword(Plotly.NET.ColorKeyword.Silver);
134-
case "ConcurrLRU":
134+
case "ConcurrentLru":
135135
return Plotly.NET.Color.fromKeyword(Plotly.NET.ColorKeyword.RoyalBlue);
136-
case "ConcurrLFU":
136+
case "ConcurrentLfu":
137137
return Plotly.NET.Color.fromRGB(255, 192, 0);
138138
default:
139139
return Plotly.NET.Color.fromKeyword(Plotly.NET.ColorKeyword.FireBrick);

BitFaster.Caching.ThroughputAnalysis/Runner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static void RunTest(Mode mode, int cacheSize)
5959
(sched as IDisposable)?.Dispose();
6060

6161
cacheConfig.DataRow[tc.ToString()] = thru.ToString();
62-
Console.WriteLine($"{cacheConfig.Name} ({tc:00}) {FormatThroughput(thru)} million ops/sec");
62+
Console.WriteLine($"{cacheConfig.Name.PadRight(18)} ({tc:00}) {FormatThroughput(thru)} million ops/sec");
6363
}
6464
}
6565

0 commit comments

Comments
 (0)