Fixing deadlock using cancelation token and real-time ETW session

This commit is contained in:
georgis 2014-01-27 20:29:44 -08:00
Родитель 2c778f9674
Коммит 9eba0a8857
4 изменённых файлов: 81 добавлений и 3 удалений

Просмотреть файл

@ -5,5 +5,5 @@ using System.Reflection;
[assembly: AssemblyCompany("MS Open Tech")]
[assembly: AssemblyProduct("Tx (LINQ to Logs and Traces)")]
[assembly: AssemblyCopyright("Copyright © MS Open Tech 2012")]
[assembly: AssemblyVersion("1.0.40123.0")]
[assembly: AssemblyFileVersion("1.0.40123.0")]
[assembly: AssemblyVersion("1.0.40127.0")]
[assembly: AssemblyFileVersion("1.0.40127.0")]

Просмотреть файл

@ -53,7 +53,6 @@ namespace Tx.Windows
{
_disposed = true;
EtwNativeMethods.CloseTrace(_handle);
_thread.Join();
}
}

Просмотреть файл

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
namespace Tx.Windows
{
public class PerfMetadata
{
ReadOnlyCollection<MachineInfo> _machines;
public PerfMetadata(string logFileName)
{
List<string> machines = PdhUtils.GetMachineList(logFileName);
var machineInfos = new List<MachineInfo>();
foreach (string m in machines)
{
var objects = PdhUtils.GetObjectList(logFileName, m);
var objectInfos = new List<ObjectInfo>();
foreach (string o in objects)
{
var counters = new List<string>();
var instances = new List<string>();
PdhUtils.GetCounterAndInstanceList(logFileName, m, o, out counters, out instances);
ObjectInfo info = new ObjectInfo(o, counters, instances);
objectInfos.Add(info);
}
machineInfos.Add(new MachineInfo(m, objectInfos));
}
_machines = machineInfos.AsReadOnly();
}
public IEnumerable<MachineInfo> Machines { get { return _machines; } }
}
public class MachineInfo
{
readonly string _name;
ObjectInfo[] _objects;
internal MachineInfo(string name, List<ObjectInfo> objects)
{
_name = name;
_objects = objects.ToArray();
}
public string Name { get { return _name; } }
public ObjectInfo[] Objects { get { return _objects; } }
}
public class ObjectInfo
{
readonly string _name;
string[] _counters;
string[] _instances;
internal ObjectInfo(string name, List<string> counters, List<string> instances)
{
_name = name;
_counters = counters.ToArray();
_instances = instances.ToArray();
}
public string Name { get { return _name; } }
public string[] Counters { get { return _counters; } }
public string[] Instances { get { return _instances; } }
}
}

Просмотреть файл

@ -85,6 +85,7 @@
<Compile Include="PerfCounters\PerfCounterObservable.cs" />
<Compile Include="PerfCounters\PerfCounterTypeMap.cs" />
<Compile Include="PerfCounters\PerformanceSample.cs" />
<Compile Include="PerfMetadata.cs" />
<Compile Include="SystemEvent.cs" />
</ItemGroup>
<ItemGroup>