Skip to content

Commit

Permalink
Fix bug. Can't have TimeSpan in event source. (#271)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Watson <[email protected]>
  • Loading branch information
benmwatson and Ben Watson authored Feb 7, 2023
1 parent 27f27f4 commit 0a6f713
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Events.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Copyright (c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -89,15 +89,15 @@ public void MemoryStreamCreated(Guid guid, string tag, long requestedSize, long
/// </summary>
/// <param name="guid">A unique ID for this stream.</param>
/// <param name="tag">A temporary ID for this stream, usually indicates current usage.</param>
/// <param name="lifetime">Lifetime of the stream</param>
/// <param name="lifetimeMs">Lifetime in milliseconds of the stream</param>
/// <param name="allocationStack">Call stack of initial allocation.</param>
/// <param name="disposeStack">Call stack of the dispose.</param>
[Event(2, Level = EventLevel.Verbose, Version = 3)]
public void MemoryStreamDisposed(Guid guid, string tag, TimeSpan lifetime, string allocationStack, string disposeStack)
public void MemoryStreamDisposed(Guid guid, string tag, long lifetimeMs, string allocationStack, string disposeStack)
{
if (this.IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
WriteEvent(2, guid, tag ?? string.Empty, lifetime, allocationStack ?? string.Empty, disposeStack ?? string.Empty);
WriteEvent(2, guid, tag ?? string.Empty, lifetimeMs, allocationStack ?? string.Empty, disposeStack ?? string.Empty);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/RecyclableMemoryStreamManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Copyright (c) 2015-2016 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -667,7 +667,7 @@ internal void ReportStreamCreated(Guid id, string tag, long requestedSize, long

internal void ReportStreamDisposed(Guid id, string tag, TimeSpan lifetime, string allocationStack, string disposeStack)
{
Events.Writer.MemoryStreamDisposed(id, tag, lifetime, allocationStack, disposeStack);
Events.Writer.MemoryStreamDisposed(id, tag, (long)lifetime.TotalMilliseconds, allocationStack, disposeStack);
this.StreamDisposed?.Invoke(this, new StreamDisposedEventArgs(id, tag, lifetime, allocationStack, disposeStack));
}

Expand Down

0 comments on commit 0a6f713

Please sign in to comment.