Skip to content
Open
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
33 changes: 33 additions & 0 deletions src/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ public void MemoryStreamCreated(Guid guid, string? tag, long requestedSize, long
{
if (this.IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
#if NET8_0_OR_GREATER
this.WriteEvent(1, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, requestedSize, actualSize });
#else
this.WriteEvent(1, guid, tag ?? string.Empty, requestedSize, actualSize);
#endif
}
}

Expand All @@ -97,7 +101,11 @@ public void MemoryStreamDisposed(Guid guid, string? tag, long lifetimeMs, string
{
if (this.IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
#if NET8_0_OR_GREATER
this.WriteEvent(2, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, lifetimeMs, allocationStack ?? string.Empty, disposeStack ?? string.Empty });
#else
this.WriteEvent(2, guid, tag ?? string.Empty, lifetimeMs, allocationStack ?? string.Empty, disposeStack ?? string.Empty);
#endif
}
}

Expand All @@ -116,8 +124,13 @@ public void MemoryStreamDoubleDispose(Guid guid, string? tag, string? allocation
{
if (this.IsEnabled())
{
#if NET8_0_OR_GREATER
this.WriteEvent(3, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, allocationStack ?? string.Empty,
disposeStack1 ?? string.Empty, disposeStack2 ?? string.Empty });
#else
this.WriteEvent(3, guid, tag ?? string.Empty, allocationStack ?? string.Empty,
disposeStack1 ?? string.Empty, disposeStack2 ?? string.Empty);
#endif
}
}

Expand All @@ -133,7 +146,11 @@ public void MemoryStreamFinalized(Guid guid, string? tag, string? allocationStac
{
if (this.IsEnabled())
{
#if NET8_0_OR_GREATER
this.WriteEvent(4, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, allocationStack ?? string.Empty });
#else
this.WriteEvent(4, guid, tag ?? string.Empty, allocationStack ?? string.Empty);
#endif
}
}

Expand All @@ -150,7 +167,11 @@ public void MemoryStreamToArray(Guid guid, string? tag, string? stack, long size
{
if (this.IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
#if NET8_0_OR_GREATER
this.WriteEvent(5, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, stack ?? string.Empty, size });
#else
this.WriteEvent(5, guid, tag ?? string.Empty, stack ?? string.Empty, size);
#endif
}
}

Expand Down Expand Up @@ -209,7 +230,11 @@ public void MemoryStreamNonPooledLargeBufferCreated(Guid guid, string? tag, long
{
if (this.IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
#if NET8_0_OR_GREATER
this.WriteEvent(9, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, requiredSize, allocationStack ?? string.Empty });
#else
this.WriteEvent(9, guid, tag ?? string.Empty, requiredSize, allocationStack ?? string.Empty);
#endif
}
}

Expand All @@ -232,7 +257,11 @@ public void MemoryStreamDiscardBuffer(Guid guid, string? tag, MemoryStreamBuffer
{
if (this.IsEnabled(EventLevel.Warning, EventKeywords.None))
{
#if NET8_0_OR_GREATER
this.WriteEvent(10, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, bufferType, reason, smallBlocksFree, smallPoolBytesFree, smallPoolBytesInUse, largeBlocksFree, largePoolBytesFree, largePoolBytesInUse });
#else
this.WriteEvent(10, guid, tag ?? string.Empty, bufferType, reason, smallBlocksFree, smallPoolBytesFree, smallPoolBytesInUse, largeBlocksFree, largePoolBytesFree, largePoolBytesInUse);
#endif
}
}

Expand All @@ -250,7 +279,11 @@ public void MemoryStreamOverCapacity(Guid guid, string? tag, long requestedCapac
{
if (this.IsEnabled())
{
#if NET8_0_OR_GREATER
this.WriteEvent(11, new EventSource.EventSourcePrimitive[] { guid, tag ?? string.Empty, requestedCapacity, maxCapacity, allocationStack ?? string.Empty });
#else
this.WriteEvent(11, guid, tag ?? string.Empty, requestedCapacity, maxCapacity, allocationStack ?? string.Empty);
#endif
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.IO.RecyclableMemoryStream.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>Microsoft.IO</RootNamespace>
Expand Down