| 1 |
using System.Collections.Generic; |
| 2 |
|
| 3 |
namespace Mono.Documentation.Updater.Statistics |
| 4 |
{ |
| 5 |
/// <summary> |
| 6 |
/// The class stores statistics for different frameworks |
| 7 |
/// </summary> |
| 8 |
public class StatisticsCollector |
| 9 |
{ |
| 10 |
/// <summary> |
| 11 |
/// Collected statistics for each framework |
| 12 |
/// </summary> |
| 13 |
public Dictionary<string, StatisticsStorage> Storages { get; } = |
| 14 |
new Dictionary<string, StatisticsStorage>(); |
| 15 |
|
| 16 |
/// <summary> |
| 17 |
/// Change metric value for the item |
| 18 |
/// </summary> |
| 19 |
/// <param name="framework">The framework name which statistics is being collected</param> |
| 20 |
/// <param name="item">The item which metrics value is changing</param> |
| 21 |
/// <param name="metrics">The metrics which value is changing</param> |
| 22 |
/// <param name="delta">The value by which the metrics value should be changed</param> |
| 23 |
public void AddMetric(string framework, StatisticsItem item, StatisticsMetrics metrics, int delta = 1) |
| 24 |
{ |
| 25 |
if (!Storages.ContainsKey(framework)) |
| 26 |
{ |
| 27 |
Storages[framework] = new StatisticsStorage(); |
| 28 |
} |
| 29 |
|
| 30 |
Storages[framework].AddMetric(item, metrics, delta); |
| 31 |
} |
| 32 |
} |
| 33 |
} |