Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FixedSizeLabelNameDictionary.cs
Go to the documentation of this file.
1
using
System.Collections.Concurrent
;
2
using
System.Collections.Generic
;
3
4
namespace
System.Diagnostics.Metrics
;
5
6
internal
class
FixedSizeLabelNameDictionary
<
TStringSequence
,
TObjectSequence
, TAggregator> :
ConcurrentDictionary
<TStringSequence, ConcurrentDictionary<TObjectSequence, TAggregator>>
where
TStringSequence
:
IStringSequence
,
IEquatable
<TStringSequence>
where
TObjectSequence
:
IObjectSequence
,
IEquatable
<TObjectSequence>
where
TAggregator :
Aggregator
7
{
8
public
void
Collect
(
Action<LabeledAggregationStatistics>
visitFunc
)
9
{
10
using
IEnumerator
<
KeyValuePair<TStringSequence, ConcurrentDictionary<TObjectSequence, TAggregator>
>>
enumerator
=
GetEnumerator
();
11
while
(
enumerator
.MoveNext())
12
{
13
KeyValuePair<TStringSequence, ConcurrentDictionary<TObjectSequence, TAggregator>
> current =
enumerator
.Current;
14
Span<string>
span
= current.Key.AsSpan();
15
foreach
(
KeyValuePair<TObjectSequence, TAggregator>
item
in
current.Value)
16
{
17
Span<object>
span2
=
item
.Key.AsSpan();
18
KeyValuePair<string, string>
[]
array
=
new
KeyValuePair<string, string>
[
span
.Length];
19
for
(
int
i = 0; i <
array
.Length; i++)
20
{
21
array
[i] =
new
KeyValuePair<string, string>
(
span
[i],
span2
[i]?.
ToString
() ??
""
);
22
}
23
IAggregationStatistics
stats
=
item
.Value.Collect();
24
visitFunc
(
new
LabeledAggregationStatistics
(
stats
,
array
));
25
}
26
}
27
}
28
29
public
ConcurrentDictionary<TObjectSequence, TAggregator>
GetValuesDictionary
(
in
TStringSequence
names
)
30
{
31
return
GetOrAdd
(
names
, (
TStringSequence
_
) =>
new
ConcurrentDictionary<TObjectSequence, TAggregator>
());
32
}
33
}
System.Collections.Concurrent.ConcurrentDictionary< TStringSequence, ConcurrentDictionary< TObjectSequence, TAggregator > >::GetEnumerator
IEnumerator< KeyValuePair< TKey, TValue > > GetEnumerator()
Definition
ConcurrentDictionary.cs:788
System.Collections.Concurrent.ConcurrentDictionary< TStringSequence, ConcurrentDictionary< TObjectSequence, TAggregator > >::GetOrAdd
TValue GetOrAdd(TKey key, Func< TKey, TValue > valueFactory)
Definition
ConcurrentDictionary.cs:895
System.Collections.Concurrent.ConcurrentDictionary
Definition
ConcurrentDictionary.cs:13
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Diagnostics.Metrics.Aggregator
Definition
Aggregator.cs:4
System.Diagnostics.Metrics.FixedSizeLabelNameDictionary.Collect
void Collect(Action< LabeledAggregationStatistics > visitFunc)
Definition
FixedSizeLabelNameDictionary.cs:8
System.Diagnostics.Metrics.FixedSizeLabelNameDictionary.GetValuesDictionary
ConcurrentDictionary< TObjectSequence, TAggregator > GetValuesDictionary(in TStringSequence names)
Definition
FixedSizeLabelNameDictionary.cs:29
System.Diagnostics.Metrics.FixedSizeLabelNameDictionary
Definition
FixedSizeLabelNameDictionary.cs:7
System.Diagnostics.Metrics.LabeledAggregationStatistics
Definition
LabeledAggregationStatistics.cs:6
System.Collections.Generic.IEnumerator
Definition
IEnumerator.cs:4
System.Diagnostics.Metrics.IAggregationStatistics
Definition
IAggregationStatistics.cs:4
System.Diagnostics.Metrics.IObjectSequence
Definition
IObjectSequence.cs:4
System.Diagnostics.Metrics.IStringSequence
Definition
IStringSequence.cs:4
System.IEquatable
Definition
IEquatable.cs:4
System.Collections.Concurrent
Definition
BlockingCollection.cs:8
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Diagnostics.Metrics
Definition
AggregationManager.cs:6
System.TypeNameKind.ToString
@ ToString
System.ExceptionArgument.item
@ item
System.ExceptionArgument.array
@ array
source
System.Diagnostics.DiagnosticSource
System.Diagnostics.Metrics
FixedSizeLabelNameDictionary.cs
Generated by
1.10.0