Merge pull request #250 from microsoft/users/mijeong/remove_raw_provider_allocation

Only allocate one EventRecordMetadata^ and reuse it for RawProvider events
This commit is contained in:
mjeong92 2024-11-12 15:41:45 -08:00 коммит произвёл GitHub
Родитель 4b1456c39a 3a7b787275
Коммит af17f4c79a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 27 добавлений и 11 удалений

Просмотреть файл

@ -32,7 +32,7 @@ using namespace System::Security::Permissions;
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("4.4.2.0")];
[assembly:AssemblyVersionAttribute("4.4.3.0")];
[assembly:ComVisible(false)];

Просмотреть файл

@ -26,6 +26,17 @@ namespace Microsoft { namespace O365 { namespace Security { namespace ETW {
: record_(&record)
, header_(&record.EventHeader) { }
EventRecordMetadata() { }
/// <summary>
/// Updates this instance to point to the specified event record.
/// </summary>
virtual void Update(const EVENT_RECORD& record)
{
record_ = &record;
header_ = &record.EventHeader;
}
public:
// For container ID's, we are expecting format "00000000-0000-0000-0000-0000000000000",
// 32 hex digits with 4 hyphens, no braces.

Просмотреть файл

@ -122,6 +122,7 @@ namespace Microsoft { namespace O365 { namespace Security { namespace ETW {
NativePtr<krabs::provider<>> provider_;
GCHandle delegateHookHandle_;
GCHandle delegateHandle_;
EventRecordMetadata^ data_;
void SetUpProvider();
};
@ -148,6 +149,8 @@ namespace Microsoft { namespace O365 { namespace Security { namespace ETW {
delegateHookHandle_ = GCHandle::Alloc(bridged);
provider_->add_on_event_callback((krabs::c_provider_callback)bridged.ToPointer());
data_ = gcnew EventRecordMetadata();
}
inline RawProvider::~RawProvider()
@ -165,6 +168,8 @@ namespace Microsoft { namespace O365 { namespace Security { namespace ETW {
inline void RawProvider::EventNotification(const EVENT_RECORD &record)
{
OnEvent(gcnew EventRecordMetadata(record));
data_->Update(record);
OnEvent(data_);
}
} } } }

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Microsoft.O365.Security.Native.ETW.Debug</id>
<version>4.4.2</version>
<version>4.4.3</version>
<title>Microsoft.O365.Security.Native.ETW Debug - managed wrappers for krabsetw</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
@ -12,8 +12,8 @@
<description>Microsoft.O365.Security.Native.ETW Debug is a managed wrapper around the krabsetw ETW library. This is the Debug build.</description>
<summary>Microsoft.O365.Security.Native.ETW Debug is a managed wrapper around the krabsetw ETW library. This is the Debug build.</summary>
<releaseNotes>
Version 4.4.2:
- Support reading TraceLogging events.
Version 4.4.3:
- RawProvider only allocates EventRecordMetadata once per instance.
</releaseNotes>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<language />

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Microsoft.O365.Security.Native.ETW</id>
<version>4.4.2</version>
<version>4.4.3</version>
<title>Microsoft.O365.Security.Native.ETW - managed wrappers for krabsetw</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
@ -12,8 +12,8 @@
<description>Microsoft.O365.Security.Native.ETW is a managed wrapper around the krabsetw ETW library.</description>
<summary>Microsoft.O365.Security.Native.ETW is a managed wrapper around the krabsetw ETW library.</summary>
<releaseNotes>
Version 4.4.2:
- Support reading TraceLogging events.
Version 4.4.3:
- RawProvider only allocates EventRecordMetadata once per instance.
</releaseNotes>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<language />

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Microsoft.O365.Security.Krabsetw</id>
<version>4.4.2</version>
<version>4.4.3</version>
<title>Krabs ETW Wrappers</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
@ -12,8 +12,8 @@
<description>Krabs ETW provides a modern C++ wrapper around the low-level ETW trace consumption functions</description>
<summary>Krabs ETW provides a modern C++ wrapper around the low-level ETW trace consumption functions</summary>
<releaseNotes>
Version 4.4.2:
- Support reading TraceLogging events.
Version 4.4.3:
- RawProvider only allocates EventRecordMetadata once per instance.
</releaseNotes>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<language />