Skip to content

Commit 9f1ef6d

Browse files
committed
[DotnetTrace] Update tests
1 parent b190d73 commit 9f1ef6d

File tree

4 files changed

+337
-470
lines changed

4 files changed

+337
-470
lines changed

src/Tools/dotnet-trace/ProviderUtils.cs

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -71,86 +71,6 @@ private enum ProviderSource
7171
ProfileArg = 4,
7272
}
7373

74-
public static void MergeProfileAndProviders(Profile selectedProfile, List<EventPipeProvider> providerCollection, Dictionary<string, string> enabledBy)
75-
{
76-
List<EventPipeProvider> profileProviders = new();
77-
// If user defined a different key/level on the same provider via --providers option that was specified via --profile option,
78-
// --providers option takes precedence. Go through the list of providers specified and only add it if it wasn't specified
79-
// via --providers options.
80-
if (selectedProfile.Providers != null)
81-
{
82-
foreach (EventPipeProvider selectedProfileProvider in selectedProfile.Providers)
83-
{
84-
bool shouldAdd = true;
85-
86-
foreach (EventPipeProvider providerCollectionProvider in providerCollection)
87-
{
88-
if (providerCollectionProvider.Name.Equals(selectedProfileProvider.Name))
89-
{
90-
shouldAdd = false;
91-
break;
92-
}
93-
}
94-
95-
if (shouldAdd)
96-
{
97-
enabledBy[selectedProfileProvider.Name] = "--profile ";
98-
profileProviders.Add(selectedProfileProvider);
99-
}
100-
}
101-
}
102-
providerCollection.AddRange(profileProviders);
103-
}
104-
105-
public static List<EventPipeProvider> ToProviders(string providersRawInput)
106-
{
107-
if (providersRawInput == null)
108-
{
109-
throw new ArgumentNullException(nameof(providersRawInput));
110-
}
111-
112-
if (string.IsNullOrWhiteSpace(providersRawInput))
113-
{
114-
return new List<EventPipeProvider>();
115-
}
116-
117-
IEnumerable<EventPipeProvider> providers = providersRawInput.Split(',').Select(ToProvider).ToList();
118-
119-
// Dedupe the entries
120-
providers = providers.GroupBy(p => p.Name)
121-
.Select(p => {
122-
string providerName = p.Key;
123-
EventLevel providerLevel = EventLevel.Critical;
124-
long providerKeywords = 0;
125-
IDictionary<string, string> providerFilterArgs = null;
126-
127-
foreach (EventPipeProvider currentProvider in p)
128-
{
129-
providerKeywords |= currentProvider.Keywords;
130-
131-
if ((currentProvider.EventLevel == EventLevel.LogAlways)
132-
|| (providerLevel != EventLevel.LogAlways && currentProvider.EventLevel > providerLevel))
133-
{
134-
providerLevel = currentProvider.EventLevel;
135-
}
136-
137-
if (currentProvider.Arguments != null)
138-
{
139-
if (providerFilterArgs != null)
140-
{
141-
throw new ArgumentException($"Provider \"{providerName}\" is declared multiple times with filter arguments.");
142-
}
143-
144-
providerFilterArgs = currentProvider.Arguments;
145-
}
146-
}
147-
148-
return new EventPipeProvider(providerName, providerLevel, providerKeywords, providerFilterArgs);
149-
});
150-
151-
return providers.ToList();
152-
}
153-
15474
public static List<EventPipeProvider> ToProviders(string[] providersArg, string clreventsArg, string clreventlevel, string[] profiles, bool shouldPrintProviders)
15575
{
15676
Dictionary<string, EventPipeProvider> merged = new(StringComparer.OrdinalIgnoreCase);
@@ -180,11 +100,7 @@ public static List<EventPipeProvider> ToProviders(string[] providersArg, string
180100
merged[provider.Name] = provider;
181101
providerSources[provider.Name] = (int)ProviderSource.CLREventsArg;
182102
}
183-
else
184-
{
185-
merged[provider.Name] = MergeProviderConfigs(existing, provider);
186-
providerSources[provider.Name] |= (int)ProviderSource.CLREventsArg;
187-
}
103+
// Prefer providers set through --providers over --clrevents
188104
}
189105
}
190106

src/tests/dotnet-trace/ProfileProviderMerging.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)