Skip to content
Merged
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
551 changes: 551 additions & 0 deletions src/EventLogExpert.Eventing/Common/Events/EventColumnStore.cs

Large diffs are not rendered by default.

246 changes: 246 additions & 0 deletions src/EventLogExpert.Eventing/Common/Events/EventColumnStoreReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,149 @@ public void BucketTimeTicksByEventDataHResult(
_store.BucketTimeTicksByEventDataHResult(rankByPhysical, minTicks, bucketSpanTicks, bucketCount, fieldName, eligibleProviders, userDataErrorCodePaths, targetCodes, slotCount, slotCounts, cancellationToken);
}

public void BucketTimeTicksByEventDataHResultWithTie(
ReadOnlySpan<int> rankByPhysical,
ReadOnlySpan<byte> highlightWinners,
uint[] slotColorMask,
long minTicks,
long bucketSpanTicks,
int bucketCount,
string fieldName,
IReadOnlyCollection<string> eligibleProviders,
IReadOnlyList<string> userDataErrorCodePaths,
long[] targetCodes,
int[] slotCounts,
CancellationToken cancellationToken)
{
ArgumentException.ThrowIfNullOrEmpty(fieldName);
ArgumentNullException.ThrowIfNull(eligibleProviders);
ArgumentNullException.ThrowIfNull(userDataErrorCodePaths);
ArgumentNullException.ThrowIfNull(targetCodes);
ArgumentNullException.ThrowIfNull(slotCounts);
ArgumentNullException.ThrowIfNull(slotColorMask);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);
ArgumentOutOfRangeException.ThrowIfNotEqual(highlightWinners.Length, Count);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketSpanTicks, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketCount, 1);

int slotCount = targetCodes.Length + 1;
ArgumentOutOfRangeException.ThrowIfLessThan(slotCounts.Length, bucketCount * slotCount);
ArgumentOutOfRangeException.ThrowIfLessThan(slotColorMask.Length, slotCount);

_store.BucketTimeTicksByEventDataHResultWithTie(rankByPhysical,
highlightWinners,
slotColorMask,
minTicks,
bucketSpanTicks,
bucketCount,
fieldName,
eligibleProviders,
userDataErrorCodePaths,
targetCodes,
slotCount,
slotCounts,
cancellationToken);
}

public void BucketTimeTicksByEventDataString(
ReadOnlySpan<int> rankByPhysical,
long minTicks,
long bucketSpanTicks,
int bucketCount,
string[] candidateFields,
IReadOnlyDictionary<string, int> rawValueToSlot,
int slotCount,
int[] slotCounts,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(candidateFields);
ArgumentNullException.ThrowIfNull(rawValueToSlot);
ArgumentNullException.ThrowIfNull(slotCounts);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketSpanTicks, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketCount, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(slotCount, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(slotCounts.Length, bucketCount * slotCount);

_store.BucketTimeTicksByEventDataString(rankByPhysical, minTicks, bucketSpanTicks, bucketCount, candidateFields, rawValueToSlot, slotCount, slotCounts, cancellationToken);
}

public void BucketTimeTicksByEventDataStringWithTie(
ReadOnlySpan<int> rankByPhysical,
ReadOnlySpan<byte> highlightWinners,
uint[] slotColorMask,
long minTicks,
long bucketSpanTicks,
int bucketCount,
string[] candidateFields,
IReadOnlyDictionary<string, int> rawValueToSlot,
int slotCount,
int[] slotCounts,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(candidateFields);
ArgumentNullException.ThrowIfNull(rawValueToSlot);
ArgumentNullException.ThrowIfNull(slotCounts);
ArgumentNullException.ThrowIfNull(slotColorMask);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);
ArgumentOutOfRangeException.ThrowIfNotEqual(highlightWinners.Length, Count);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketSpanTicks, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketCount, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(slotCount, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(slotCounts.Length, bucketCount * slotCount);
ArgumentOutOfRangeException.ThrowIfLessThan(slotColorMask.Length, slotCount);

_store.BucketTimeTicksByEventDataStringWithTie(rankByPhysical,
highlightWinners,
slotColorMask,
minTicks,
bucketSpanTicks,
bucketCount,
candidateFields,
rawValueToSlot,
slotCount,
slotCounts,
cancellationToken);
}

public void BucketTimeTicksByEventDataWithTie(
ReadOnlySpan<int> rankByPhysical,
ReadOnlySpan<byte> highlightWinners,
uint[] slotColorMask,
long minTicks,
long bucketSpanTicks,
int bucketCount,
string fieldName,
long[] targetCodes,
int[] slotCounts,
CancellationToken cancellationToken)
{
ArgumentException.ThrowIfNullOrEmpty(fieldName);
ArgumentNullException.ThrowIfNull(targetCodes);
ArgumentNullException.ThrowIfNull(slotCounts);
ArgumentNullException.ThrowIfNull(slotColorMask);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);
ArgumentOutOfRangeException.ThrowIfNotEqual(highlightWinners.Length, Count);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketSpanTicks, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketCount, 1);

int slotCount = targetCodes.Length + 1;
ArgumentOutOfRangeException.ThrowIfLessThan(slotCounts.Length, bucketCount * slotCount);
ArgumentOutOfRangeException.ThrowIfLessThan(slotColorMask.Length, slotCount);

_store.BucketTimeTicksByEventDataWithTie(rankByPhysical,
highlightWinners,
slotColorMask,
minTicks,
bucketSpanTicks,
bucketCount,
fieldName,
targetCodes,
slotCount,
slotCounts,
cancellationToken);
}

public void BucketTimeTicksByEventId(
ReadOnlySpan<int> rankByPhysical,
long minTicks,
Expand All @@ -107,6 +250,41 @@ public void BucketTimeTicksByEventId(
_store.BucketTimeTicksByEventId(rankByPhysical, minTicks, bucketSpanTicks, bucketCount, targetIds, slotCount, slotCounts, cancellationToken);
}

public void BucketTimeTicksByEventIdWithTie(
ReadOnlySpan<int> rankByPhysical,
ReadOnlySpan<byte> highlightWinners,
uint[] slotColorMask,
long minTicks,
long bucketSpanTicks,
int bucketCount,
int[] targetIds,
int[] slotCounts,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(targetIds);
ArgumentNullException.ThrowIfNull(slotCounts);
ArgumentNullException.ThrowIfNull(slotColorMask);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);
ArgumentOutOfRangeException.ThrowIfNotEqual(highlightWinners.Length, Count);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketSpanTicks, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketCount, 1);

int slotCount = targetIds.Length + 1;
ArgumentOutOfRangeException.ThrowIfLessThan(slotCounts.Length, bucketCount * slotCount);
ArgumentOutOfRangeException.ThrowIfLessThan(slotColorMask.Length, slotCount);

_store.BucketTimeTicksByEventIdWithTie(rankByPhysical,
highlightWinners,
slotColorMask,
minTicks,
bucketSpanTicks,
bucketCount,
targetIds,
slotCount,
slotCounts,
cancellationToken);
}

public void BucketTimeTicksByField(
ReadOnlySpan<int> rankByPhysical,
long minTicks,
Expand All @@ -129,6 +307,43 @@ public void BucketTimeTicksByField(
_store.BucketTimeTicksByField(rankByPhysical, minTicks, bucketSpanTicks, bucketCount, ToColumnField(field), targetValues, slotCount, slotCounts, cancellationToken);
}

public void BucketTimeTicksByFieldWithTie(
ReadOnlySpan<int> rankByPhysical,
ReadOnlySpan<byte> highlightWinners,
uint[] slotColorMask,
long minTicks,
long bucketSpanTicks,
int bucketCount,
EventFieldId field,
string[] targetValues,
int[] slotCounts,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(targetValues);
ArgumentNullException.ThrowIfNull(slotCounts);
ArgumentNullException.ThrowIfNull(slotColorMask);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);
ArgumentOutOfRangeException.ThrowIfNotEqual(highlightWinners.Length, Count);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketSpanTicks, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketCount, 1);

int slotCount = targetValues.Length + 1;
ArgumentOutOfRangeException.ThrowIfLessThan(slotCounts.Length, bucketCount * slotCount);
ArgumentOutOfRangeException.ThrowIfLessThan(slotColorMask.Length, slotCount);

_store.BucketTimeTicksByFieldWithTie(rankByPhysical,
highlightWinners,
slotColorMask,
minTicks,
bucketSpanTicks,
bucketCount,
ToColumnField(field),
targetValues,
slotCount,
slotCounts,
cancellationToken);
}

public void BucketTimeTicksBySeverity(
ReadOnlySpan<int> rankByPhysical,
long minTicks,
Expand All @@ -146,6 +361,28 @@ public void BucketTimeTicksBySeverity(
_store.BucketTimeTicksBySeverity(rankByPhysical, minTicks, bucketSpanTicks, bucketCount, slotCounts, cancellationToken);
}

public void BucketTimeTicksBySeverityWithTie(
ReadOnlySpan<int> rankByPhysical,
ReadOnlySpan<byte> highlightWinners,
uint[] slotColorMask,
long minTicks,
long bucketSpanTicks,
int bucketCount,
int[] slotCounts,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(slotCounts);
ArgumentNullException.ThrowIfNull(slotColorMask);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);
ArgumentOutOfRangeException.ThrowIfNotEqual(highlightWinners.Length, Count);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketSpanTicks, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(bucketCount, 1);
ArgumentOutOfRangeException.ThrowIfLessThan(slotCounts.Length, bucketCount * LevelSeverity.SlotCount);
ArgumentOutOfRangeException.ThrowIfLessThan(slotColorMask.Length, LevelSeverity.SlotCount);

_store.BucketTimeTicksBySeverityWithTie(rankByPhysical, highlightWinners, slotColorMask, minTicks, bucketSpanTicks, bucketCount, slotCounts, cancellationToken);
}

public void CopyGuidColumn(EventFieldId field, Guid[] values, bool[] hasValue)
{
ArgumentNullException.ThrowIfNull(values);
Expand Down Expand Up @@ -226,6 +463,15 @@ public void CountEventDataHResults(
_store.CountEventDataHResults(rankByPhysical, fieldName, eligibleProviders, userDataErrorCodePaths, counts, cancellationToken);
}

public void CountEventDataStringValues(ReadOnlySpan<int> rankByPhysical, string[] candidateFields, IDictionary<string, int> counts, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(candidateFields);
ArgumentNullException.ThrowIfNull(counts);
ArgumentOutOfRangeException.ThrowIfNotEqual(rankByPhysical.Length, Count);

_store.CountEventDataStringValues(rankByPhysical, candidateFields, counts, cancellationToken);
}

public void CountEventDataValues(ReadOnlySpan<int> rankByPhysical, string fieldName, IDictionary<long, int> counts, CancellationToken cancellationToken)
{
ArgumentException.ThrowIfNullOrEmpty(fieldName);
Expand Down
21 changes: 20 additions & 1 deletion src/EventLogExpert.Eventing/Common/Events/EventDataView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using EventLogExpert.Eventing.Readers;
using EventLogExpert.Eventing.Resolvers;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;

namespace EventLogExpert.Eventing.Common.Events;

Expand Down Expand Up @@ -40,7 +41,7 @@ public bool TryGetValue(string? fieldName, out EventFieldValue value)
{
if (fieldName is not null
&& TryGetOrdering(out FieldNameOrdering ordering)
&& _schema!.TryGetIndex(ordering, fieldName, out int index)
&& _schema.TryGetIndex(ordering, fieldName, out int index)
&& (uint)index < (uint)_values.Length)
{
value = EventFieldValue.FromProperty(_values[index]);
Expand All @@ -53,6 +54,23 @@ public bool TryGetValue(string? fieldName, out EventFieldValue value)
return false;
}

internal bool TryGetRawValue(string? fieldName, out EventProperty property)
{
if (fieldName is not null
&& TryGetOrdering(out FieldNameOrdering ordering)
&& _schema.TryGetIndex(ordering, fieldName, out int index)
&& (uint)index < (uint)_values.Length)
{
property = _values[index];

return true;
}

property = default;

return false;
}

public bool TryGetName(int index, out string name)
{
if (TryGetOrdering(out FieldNameOrdering ordering))
Expand All @@ -77,6 +95,7 @@ public bool TryGetName(int index, out string name)
private ImmutableArray<string> OrderingNames(FieldNameOrdering ordering) =>
ordering == FieldNameOrdering.Visible ? _schema!.VisibleNames : _schema!.AllNames;

[MemberNotNullWhen(true, nameof(_schema))]
private bool TryGetOrdering(out FieldNameOrdering ordering)
{
if (_schema is not null && !_values.IsDefaultOrEmpty)
Expand Down
Loading
Loading