Skip to content

Commit

Permalink
Added the Startup Event to the Benchmarks Event Source (dotnet#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsharm authored Feb 7, 2024
1 parent 0302b6b commit 0ead447
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Microsoft.Crank.Agent/Microsoft.Crank.Agent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Crank.EventSources\Microsoft.Crank.EventSources.csproj" />
<ProjectReference Include="..\Microsoft.Crank.JobOjectWrapper\Microsoft.Crank.JobObjectWrapper.csproj" />
<ProjectReference Include="..\Microsoft.Crank.Models\Microsoft.Crank.Models.csproj" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.Crank.Agent/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Hosting.WindowsServices;
using Microsoft.Azure.Relay;
using Microsoft.Crank.EventSources;
using Microsoft.Crank.Models;
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tools.Trace;
Expand Down Expand Up @@ -5329,6 +5330,7 @@ private static bool MarkAsRunning(string hostname, Job job, Stopwatch stopwatch)
Timestamp = DateTime.UtcNow,
Value = stopwatch.ElapsedMilliseconds
});
BenchmarksEventSource.Start();

Log.Info($"Running job '{job.Service}' ({job.Id})");
job.Url = ComputeServerUrl(hostname, job);
Expand Down
11 changes: 11 additions & 0 deletions src/Microsoft.Crank.EventSources/BenchmarksEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public static void MeasureNetCoreAppVersion()
}
}

public static void Start()
{
Log.Started();
}

[Event(1, Level = EventLevel.Informational)]
public void MeasureLong(string name, long value)
{
Expand All @@ -133,5 +138,11 @@ public void Metadata(string name, string aggregate, string reduce, string shortD
{
WriteEvent(5, name, aggregate, reduce, shortDescription, longDescription, format);
}

[Event(6, Level = EventLevel.Informational)]
public void Started()
{
WriteEvent(6);
}
}
}

0 comments on commit 0ead447

Please sign in to comment.