Add support to extract manifest from ETL and generate types (on behalf of jomorri)

This commit is contained in:
Sergey Baranchenkov 2016-03-13 22:29:13 -07:00
Родитель d647379588
Коммит 9bdbe1a8b9
3 изменённых файлов: 52 добавлений и 6 удалений

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

@ -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.60301.0")]
[assembly: AssemblyFileVersion("1.0.60301.0")]
[assembly: AssemblyVersion("1.0.60312.0")]
[assembly: AssemblyFileVersion("1.0.60312.0")]

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

@ -32,7 +32,7 @@ namespace Microsoft.Etw
else
{
string target = Path.Combine(outputDirectory, assembly);
AssemblyBuilder.OutputAssembly(generated, new string[]{}, target);
AssemblyBuilder.OutputAssembly(generated, new string[] { }, target);
}
}
@ -42,7 +42,7 @@ namespace Microsoft.Etw
{
Console.WriteLine(
@"Usage:
EtwEventTypeGen [/o:dir] [/a:name] [/m:file] [/t:file] [/w:path]
EtwEventTypeGen [/o:dir] [/a:name] [/m:file] [/e:file] [/t:file] [/w:path]
Switches:
/o:dir Directory for the output.
@ -52,6 +52,7 @@ Switches:
If missing the output is C# files.
/m:manifest Input from manifest(s)
/e:etl Input from eventsource etl(s) that contain manifests
/t:tmf Input from TMF file(s)
/p:file.blg Input from performance counter trace
@ -121,6 +122,51 @@ Examples:
}
break;
case "/e:":
string[] etlFiles;
string etlDir = Path.GetDirectoryName(value);
if (String.IsNullOrEmpty(etlDir))
{
etlFiles = Directory.GetFiles(".", value);
}
else
{
etlFiles = Directory.GetFiles(
etlDir,
Path.GetFileName(value));
}
foreach (string etlFile in etlFiles)
{
string[] etlManifests = ManifestParser.ExtractFromTrace(etlFile);
if (etlManifests != null && etlManifests.Length > 0)
{
int i = 0;
foreach (string content in etlManifests)
{
Dictionary<string, string> code = ManifestParser.Parse(content);
foreach (string provider in code.Keys)
{
generated.Add(provider, code[provider]);
}
// Write the manifest text file
using (TextWriter wr =
new StreamWriter(Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(etlFile) + "_" + i.ToString() + ".man")))
{
wr.Write(content);
}
}
}
else
{
Console.WriteLine("No manifest found in file:{0}", etlFile);
}
}
break;
case "/t:":
string[] tmfs;
string tmfDir = Path.GetDirectoryName(value);
@ -194,4 +240,4 @@ Examples:
}
}
}
}
}

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

@ -150,7 +150,7 @@ namespace Tx.LinqPad
{
Title = "Add metadata files",
Multiselect = true,
Filter = "All Files|*.man|Manifests|*.man;"
Filter = "Etl Files (*.etl)|*.etl|Manifests|*.man|All Files|*.*"
};
if (fileDialog.ShowDialog().GetValueOrDefault())
{