I am using Tx.Windows
nuget package for reading performance counter blg
file.
https://github.com/Microsoft/Tx
With small size file, the result is very immediate for below code, but as my file size grow, the time taken for read also increase. With big size file (say 500MB) the time taken for file read is very large.
Is there any way to reduce file reading time?
using System;
using System.Linq;
using System.Reactive.Linq;
using Tx.Windows;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
var observable = PerfCounterObservable.FromFile(@"C:\Files\test.blg");
var grouped = from a in observable
group a by new { a.Machine, a.Instance, a.Timestamp } into groups
from g in groups.ToArray()
select new
{
groups.Key.Machine,
groups.Key.Instance,
groups.Key.Timestamp,
Counters = g
};
var all = grouped.ToEnumerable().ToArray();
Console.ReadLine();
}
}
}
The sample blg file at Microsoft Tx
github location,
https://github.com/Microsoft/Tx/blob/master/Traces/BasicPerfCounters.blg
and Here test code,
https://github.com/Microsoft/Tx/blob/master/Test/Tx.Windows.Tests/PerfCounterTest.cs