Add many more stopwatches

This commit is contained in:
Matt Nadareski
2021-02-02 14:09:49 -08:00
parent b93088c36e
commit c931c84838
10 changed files with 90 additions and 32 deletions

View File

@@ -104,6 +104,8 @@ namespace SabreTools.Filtering
/// <returns>True if cleaning was successful, false on error</returns>
public bool ApplyCleaning(DatFile datFile, bool throwOnError = false)
{
InternalStopwatch watch = new InternalStopwatch("Applying cleaning steps to DAT");
try
{
// Perform item-level cleaning
@@ -143,6 +145,10 @@ namespace SabreTools.Filtering
logger.Error(ex);
return false;
}
finally
{
watch.Stop();
}
return true;
}

View File

@@ -50,6 +50,8 @@ namespace SabreTools.Filtering
/// <param name="inputs">Field and file combinations</param>
public void PopulateFromList(List<string> inputs)
{
InternalStopwatch watch = new InternalStopwatch("Populating extras from list");
foreach (string input in inputs)
{
ExtraIniItem item = new ExtraIniItem();
@@ -70,6 +72,8 @@ namespace SabreTools.Filtering
if (item.PopulateFromFile(fileString))
Items.Add(item);
}
watch.Stop();
}
#endregion
@@ -84,6 +88,8 @@ namespace SabreTools.Filtering
/// <returns>True if the extras were applied, false on error</returns>
public bool ApplyExtras(DatFile datFile, bool throwOnError = false)
{
InternalStopwatch watch = new InternalStopwatch("Applying extra mappings to DAT");
try
{
// Bucket by game first
@@ -130,6 +136,10 @@ namespace SabreTools.Filtering
logger.Error(ex);
return false;
}
finally
{
watch.Stop();
}
return true;
}

View File

@@ -56,6 +56,8 @@ namespace SabreTools.Filtering
/// <param name="fields">List of field names</param>
public void PopulateExclusionsFromList(List<string> fields)
{
InternalStopwatch watch = new InternalStopwatch("Populating removals from list");
// Instantiate the removers, if necessary
DatHeaderRemover ??= new DatHeaderRemover();
DatItemRemover ??= new DatItemRemover();
@@ -81,6 +83,8 @@ namespace SabreTools.Filtering
// If we didn't match anything, log an error
logger.Warning($"The value {field} did not match any known field names. Please check the wiki for more details on supported field names.");
}
watch.Stop();
}
#endregion
@@ -98,7 +102,7 @@ namespace SabreTools.Filtering
return;
// Output the logging statement
logger.User("Removing filtered fields");
InternalStopwatch watch = new InternalStopwatch("Applying removals to DAT");
// Remove DatHeader fields
if (DatHeaderRemover != null)
@@ -119,6 +123,8 @@ namespace SabreTools.Filtering
datFile.Items.AddRange(key, items);
});
}
watch.Stop();
}
#endregion

View File

@@ -47,6 +47,8 @@ namespace SabreTools.Filtering
/// <returns>True if the DatFile was split, false on error</returns>
public bool ApplySplitting(DatFile datFile, bool useTags, bool throwOnError = false)
{
InternalStopwatch watch = new InternalStopwatch("Applying splitting to DAT");
try
{
// If we are using tags from the DAT, set the proper input for split type unless overridden
@@ -81,6 +83,10 @@ namespace SabreTools.Filtering
logger.Error(ex);
return false;
}
finally
{
watch.Stop();
}
return true;
}