Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CtfPlayback/CtfPlayback.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.9.2" GeneratePathProperty="true"/>
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.9.2" GeneratePathProperty="true" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion LTTngCds/LTTngCds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Performance.SDK" Version="0.109.24" />
<PackageReference Include="Microsoft.Performance.SDK" Version="1.0.9-rc1" />
</ItemGroup>

<ItemGroup>
Expand Down
25 changes: 10 additions & 15 deletions LTTngCds/LTTngDataProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,28 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using LTTngCds.CookerData;
using LTTngCds.MetadataTables;
using Microsoft.Performance.SDK.Extensibility;
using Microsoft.Performance.SDK.Extensibility.SourceParsing;
using Microsoft.Performance.SDK.Processing;

namespace LTTngCds
{
internal sealed class LTTngDataProcessor
: CustomDataProcessorBaseWithSourceParser<LTTngEvent, LTTngContext, string>,
: CustomDataProcessorWithSourceParser<LTTngEvent, LTTngContext, string>,
IDisposable
{
public LTTngDataProcessor(
ISourceParser<LTTngEvent, LTTngContext, string> sourceParser,
ProcessorOptions options,
IApplicationEnvironment applicationEnvironment,
IProcessorEnvironment processorEnvironment,
IReadOnlyDictionary<TableDescriptor, Action<ITableBuilder, IDataExtensionRetrieval>> allTablesMapping,
IEnumerable<TableDescriptor> metadataTables)
: base(sourceParser, options, applicationEnvironment, processorEnvironment, allTablesMapping, metadataTables)
ISourceParser<LTTngEvent, LTTngContext, string> sourceParser,
ProcessorOptions options,
IApplicationEnvironment applicationEnvironment,
IProcessorEnvironment processorEnvironment)
: base(sourceParser, options, applicationEnvironment, processorEnvironment)
{
}

protected override void BuildTableCore(
TableDescriptor tableDescriptor,
Action<ITableBuilder, IDataExtensionRetrieval> createTable,
TableDescriptor tableDescriptor,
ITableBuilder tableBuilder)
{
if (tableDescriptor.IsMetadataTable)
Expand All @@ -38,14 +33,14 @@ protected override void BuildTableCore(
}

private void BuildMetadataTable(
TableDescriptor tableDescriptor,
TableDescriptor tableDescriptor,
ITableBuilder tableBuilder)
{
if (tableDescriptor.Guid == TraceStatsTable.TableDescriptor.Guid)
{
TraceStatsTable.BuildMetadataTable(
tableBuilder,
this.SourceParser as LTTngSourceParser,
tableBuilder,
this.SourceParser as LTTngSourceParser,
this.ApplicationEnvironment.Serializer);
}
}
Expand Down
4 changes: 1 addition & 3 deletions LTTngCds/LTTngDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ protected override ICustomDataProcessor CreateProcessorCore(
sourceParser,
options,
this.applicationEnvironment,
processorEnvironment,
this.AllTables,
this.MetadataTables);
processorEnvironment);
}
}
}
12 changes: 6 additions & 6 deletions LTTngCds/LTTngSourceParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace LTTngCds
{
internal sealed class LTTngSourceParser
: SourceParserBase<LTTngEvent, LTTngContext, string>,
: SourceParser<LTTngEvent, LTTngContext, string>,
IDisposable
{
private ICtfInput ctfInput;
Expand Down Expand Up @@ -61,7 +61,7 @@ public void SetFolderInput(string folderPath)

public Timestamp LastEventTimestamp { get; private set; }

public DateTime FirstEventWallClock { get; private set;}
public DateTime FirstEventWallClock { get; private set; }

public ulong ProcessingTimeInMilliseconds { get; private set; }

Expand All @@ -70,8 +70,8 @@ public void SetFolderInput(string folderPath)
internal Dictionary<string, TraceStatsData> TraceStats = new Dictionary<string, TraceStatsData>(StringComparer.Ordinal);

public override void ProcessSource(
ISourceDataProcessor<LTTngEvent, LTTngContext, string> dataProcessor,
ILogger logger,
ISourceDataProcessor<LTTngEvent, LTTngContext, string> dataProcessor,
ILogger logger,
IProgress<int> progress,
CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -111,10 +111,10 @@ void EventCallback(LTTngEvent lttngEvent, LTTngContext lttngContext)
lttngCustomization.RegisterEventCallback(EventCallback);

var playback = new CtfPlayback.CtfPlayback(lttngCustomization, cancellationToken);
playback.Playback(this.ctfInput, new CtfPlaybackOptions {ReadAhead = true}, progressReport);
playback.Playback(this.ctfInput, new CtfPlaybackOptions { ReadAhead = true }, progressReport);

sw.Stop();
this.ProcessingTimeInMilliseconds = (ulong) sw.ElapsedMilliseconds;
this.ProcessingTimeInMilliseconds = (ulong)sw.ElapsedMilliseconds;
}

{
Expand Down
13 changes: 6 additions & 7 deletions LTTngCds/MetadataTables/TraceStatsTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Performance.SDK.Extensibility;
using Microsoft.Performance.SDK.Processing;

namespace LTTngCds.MetadataTables
Expand Down Expand Up @@ -32,7 +31,7 @@ public class TraceStatsTable
new ColumnMetadata(new Guid("{A804856F-698E-4BE6-8408-36B538D46813}"), "Total Payload Size"),
new UIHints { Width = 80, TextAlignment = TextAlignment.Left, });

internal static void BuildMetadataTable(ITableBuilder tableBuilder, LTTngSourceParser sourceParser, ISerializer serializer)
internal static void BuildMetadataTable(ITableBuilder tableBuilder, LTTngSourceParser sourceParser, ITableConfigurationsSerializer serializer)
{
ITableBuilderWithRowCount table = tableBuilder.SetRowCount(sourceParser.TraceStats.Count);

Expand All @@ -44,23 +43,23 @@ internal static void BuildMetadataTable(ITableBuilder tableBuilder, LTTngSourceP
var payloadBitCountProjection = traceStatsProjection.Compose(traceStats => (double)traceStats.PayloadBitCount / 8);

table.AddColumn(
new BaseDataColumn<string>(
new DataColumn<string>(
EventNameConfiguration,
eventNameProjection));

table.AddColumn(
new BaseDataColumn<ulong>(
new DataColumn<ulong>(
CountConfiguration,
eventCountProjection));

table.AddColumn(
new BaseDataColumn<double>(
new DataColumn<double>(
TotalPayloadSizeConfiguration,
payloadBitCountProjection));

var configurations = TableConfigurations.GetPrebuiltTableConfigurations(
typeof(TraceStatsTable),
TableDescriptor.Guid,
typeof(TraceStatsTable),
TableDescriptor.Guid,
serializer);

foreach (var configuration in configurations)
Expand Down
8 changes: 4 additions & 4 deletions LTTngDataExtUnitTest/LTTngDataExtUnitTest.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
Expand All @@ -8,9 +8,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Microsoft.Performance.SDK" Version="0.109.24" />
<PackageReference Include="Microsoft.Performance.SDK.Runtime" Version="0.109.24" />
<PackageReference Include="Microsoft.Performance.Toolkit.Engine" Version="0.109.24" />
<PackageReference Include="Microsoft.Performance.SDK" Version="1.0.9-rc1" />
<PackageReference Include="Microsoft.Performance.SDK.Runtime" Version="1.0.9-rc1" />
<PackageReference Include="Microsoft.Performance.Toolkit.Engine" Version="1.0.9-rc1" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
Expand Down
116 changes: 62 additions & 54 deletions LTTngDataExtUnitTest/LTTngUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
using System;
using System.Collections.Generic;
using System.IO;
using LTTngDataExtensions.SourceDataCookers;
using System.IO.Compression;
using System.Linq;
using LTTngDataExtensions.DataOutputTypes;
using LTTngDataExtensions.SourceDataCookers;
using LTTngDataExtensions.SourceDataCookers.Diagnostic_Messages;
using LTTngDataExtensions.SourceDataCookers.Disk;
using LTTngDataExtensions.SourceDataCookers.Module;
using LTTngDataExtensions.SourceDataCookers.Syscall;
using LTTngDataExtensions.SourceDataCookers.Thread;
using Microsoft.Performance.SDK.Extensibility;
using Microsoft.Performance.SDK.Processing;
using Microsoft.Performance.Toolkit.Engine;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using UnitTestCommon;
using LTTngDataExtensions.SourceDataCookers.Diagnostic_Messages;
using LTTngDataExtensions.SourceDataCookers.Module;
using LTTngDataExtensions.SourceDataCookers.Disk;
using System.IO.Compression;
using System.Linq;

namespace LTTngDataExtUnitTest
{
Expand Down Expand Up @@ -48,41 +47,39 @@ public static void ProcessTrace()
Assert.IsTrue(lttngDataPath.Exists);

// Approach #1 - Engine - Doesn't test tables UI but tests processing
var runtime = Engine.Create();

runtime.AddFile(lttngDataPath.FullName);

// Enable our various types of data
var lttngGenericEventDataCooker = new LTTngGenericEventDataCooker();
LTTngGenericEventDataCookerPath = lttngGenericEventDataCooker.Path;
runtime.EnableCooker(LTTngGenericEventDataCookerPath);

var lttngSyscallDataCooker = new LTTngSyscallDataCooker();
LTTngSyscallDataCookerPath = lttngSyscallDataCooker.Path;
runtime.EnableCooker(LTTngSyscallDataCookerPath);

var lttngThreadDataCooker = new LTTngThreadDataCooker();
LTTngThreadDataCookerPath = lttngThreadDataCooker.Path;
runtime.EnableCooker(LTTngThreadDataCookerPath);

var lttngDmesgDataCooker = new LTTngDmesgDataCooker();
LTTngDmesgDataCookerPath = lttngDmesgDataCooker.Path;
runtime.EnableCooker(LTTngDmesgDataCookerPath);

var lttngModuleDataCooker = new LTTngModuleDataCooker();
LTTngModuleDataCookerPath = lttngModuleDataCooker.Path;
runtime.EnableCooker(LTTngModuleDataCookerPath);

var lttngDiskDataCooker = new LTTngDiskDataCooker();
LTTngDiskDataCookerPath = lttngDiskDataCooker.Path;
runtime.EnableCooker(LTTngDiskDataCookerPath);

//
// Process our data.
//

RuntimeExecutionResults = runtime.Process();

var runtime = Engine.Create(new FileDataSource(lttngDataPath.FullName));

// Enable our various types of data
var lttngGenericEventDataCooker = new LTTngGenericEventDataCooker();
LTTngGenericEventDataCookerPath = lttngGenericEventDataCooker.Path;
runtime.EnableCooker(LTTngGenericEventDataCookerPath);

var lttngSyscallDataCooker = new LTTngSyscallDataCooker();
LTTngSyscallDataCookerPath = lttngSyscallDataCooker.Path;
runtime.EnableCooker(LTTngSyscallDataCookerPath);

var lttngThreadDataCooker = new LTTngThreadDataCooker();
LTTngThreadDataCookerPath = lttngThreadDataCooker.Path;
runtime.EnableCooker(LTTngThreadDataCookerPath);

var lttngDmesgDataCooker = new LTTngDmesgDataCooker();
LTTngDmesgDataCookerPath = lttngDmesgDataCooker.Path;
runtime.EnableCooker(LTTngDmesgDataCookerPath);

var lttngModuleDataCooker = new LTTngModuleDataCooker();
LTTngModuleDataCookerPath = lttngModuleDataCooker.Path;
runtime.EnableCooker(LTTngModuleDataCookerPath);

var lttngDiskDataCooker = new LTTngDiskDataCooker();
LTTngDiskDataCookerPath = lttngDiskDataCooker.Path;
runtime.EnableCooker(LTTngDiskDataCookerPath);

//
// Process our data.
//

RuntimeExecutionResults = runtime.Process();

IsTraceProcessed = true;
}
}
Expand All @@ -96,18 +93,29 @@ public void ProcessTraceAsFolder()

string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

ZipFile.ExtractToDirectory(lttngData[0], tempDirectory);

// Approach #1 - Engine - Doesn't test tables UI but tests processing
var runtime = Engine.Create();

var ds = new DirectoryDataSource(tempDirectory);
runtime.AddDataSource(ds);

Assert.IsTrue(ds.IsDirectory());
Assert.IsTrue(runtime.SourceDataCookers.Count() >= 1);
Assert.IsTrue(runtime.AvailableTables.Count() >= 1);

using (var zipFile = ZipFile.OpenRead(lttngData[0]))
{
zipFile.ExtractToDirectory(tempDirectory);
}

using (var dataSourceSet = DataSourceSet.Create())
{
var ds = new DirectoryDataSource(tempDirectory);
dataSourceSet.AddDataSource(ds);

// Approach #1 - Engine - Doesn't test tables UI but tests processing
using (var runtime = Engine.Create(new EngineCreateInfo(dataSourceSet.AsReadOnly())))
{
//
// We do not assert that any cookers are enabled since we did not explicitly enable cookers here
//

Assert.IsTrue(ds.IsDirectory());
Assert.IsTrue(runtime.AvailableTables.Count() >= 1);
}
}


Directory.Delete(tempDirectory, true);
}

Expand Down
2 changes: 1 addition & 1 deletion LTTngDataExtensions/LTTngDataExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Performance.SDK" Version="0.109.24" />
<PackageReference Include="Microsoft.Performance.SDK" Version="1.0.9-rc1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading