Add stopwatches to Filter as well

This commit is contained in:
Matt Nadareski
2021-02-02 14:20:56 -08:00
parent c931c84838
commit 89bd2772b6
2 changed files with 10 additions and 1 deletions

View File

@@ -96,6 +96,8 @@ namespace SabreTools.Filtering
if (filters == null || filters.Count == 0) if (filters == null || filters.Count == 0)
return; return;
InternalStopwatch watch = new InternalStopwatch("Populating filters from list");
foreach (string filterPair in filters) foreach (string filterPair in filters)
{ {
(string field, string value, bool negate) = ProcessFilterPair(filterPair); (string field, string value, bool negate) = ProcessFilterPair(filterPair);
@@ -123,6 +125,8 @@ namespace SabreTools.Filtering
// If we didn't match anything, log an error // If we didn't match anything, log an error
logger.Warning($"The value {field} did not match any filterable field names. Please check the wiki for more details on supported field names."); logger.Warning($"The value {field} did not match any filterable field names. Please check the wiki for more details on supported field names.");
} }
watch.Stop();
} }
/// <summary> /// <summary>
@@ -372,6 +376,8 @@ namespace SabreTools.Filtering
if (MachineFilter == null || DatItemFilter == null) if (MachineFilter == null || DatItemFilter == null)
return false; return false;
InternalStopwatch watch = new InternalStopwatch("Applying filters to DAT");
// If we're filtering per machine, bucket by machine first // If we're filtering per machine, bucket by machine first
if (perMachine) if (perMachine)
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None); datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None);
@@ -427,6 +433,10 @@ namespace SabreTools.Filtering
logger.Error(ex); logger.Error(ex);
return false; return false;
} }
finally
{
watch.Stop();
}
return true; return true;
} }

View File

@@ -101,7 +101,6 @@ namespace SabreTools.Filtering
if (DatHeaderRemover == null && DatItemRemover == null) if (DatHeaderRemover == null && DatItemRemover == null)
return; return;
// Output the logging statement
InternalStopwatch watch = new InternalStopwatch("Applying removals to DAT"); InternalStopwatch watch = new InternalStopwatch("Applying removals to DAT");
// Remove DatHeader fields // Remove DatHeader fields