Skip to content

Commit 5fcf716

Browse files
committed
Fix hook and dylib
1 parent 03e8a6b commit 5fcf716

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/Ultra.Core/Ultra.Core.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</PackageReference>
4545
</ItemGroup>
4646

47-
<!--<ItemGroup>
47+
<ItemGroup>
4848
<Content Include="..\Ultra.Sampler\libUltraSampler.dylib">
4949
<Link>libUltraSampler.dylib</Link>
5050
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -53,5 +53,5 @@
5353
<Link>libUltraSamplerHook.dylib</Link>
5454
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5555
</Content>
56-
</ItemGroup>-->
56+
</ItemGroup>
5757
</Project>

src/Ultra.Core/UltraProfilerEventPipe.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Ultra.Core;
1111
/// </summary>
1212
internal sealed class UltraProfilerEventPipe : UltraProfiler
1313
{
14-
private static string PathToNativeUltraSampler => Path.Combine(AppContext.BaseDirectory, "libUltraSamplerHook.dyld");
14+
private static string PathToNativeUltraSampler => Path.Combine(AppContext.BaseDirectory, "libUltraSamplerHook.dylib");
1515

1616
/// <summary>
1717
/// Initializes a new instance of the <see cref="UltraProfiler"/> class.
@@ -97,11 +97,13 @@ private static void SetupUltraSampler(ProcessStartInfo startInfo)
9797

9898
private class UltraSamplerProfilerState
9999
{
100+
private readonly CancellationToken _token;
100101
private readonly DiagnosticPortSession _samplerSession;
101102
private readonly DiagnosticPortSession _clrSession;
102-
103+
103104
public UltraSamplerProfilerState(string baseName, int pid, CancellationToken token)
104105
{
106+
_token = token;
105107
_samplerSession = new(pid, true, baseName, token);
106108
_clrSession = new(pid, false, baseName, token);
107109
}
@@ -129,8 +131,11 @@ public long TotalFileLength()
129131
public async Task StartProfiling()
130132
{
131133
await _samplerSession.WaitForConnectAndStartSession();
134+
135+
await _samplerSession.StartProfiling(_token);
136+
await _clrSession.StartProfiling(_token);
132137
}
133-
138+
134139
public async ValueTask StopAndDisposeAsync()
135140
{
136141
await _samplerSession.StopAndDisposeAsync().ConfigureAwait(false);
3.43 MB
Binary file not shown.
33.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)