Add code to support 'display_processing_time' use (#3095)

* Add code to support using 'display_processing_time' for functional performance
* Cleanup use of getFunctionName() so this is only called once and re-used
This commit is contained in:
abraunegg 2025-02-02 08:18:15 +11:00 committed by GitHub
commit 518b152c4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2138 additions and 108 deletions

2229
src/sync.d

File diff suppressed because it is too large Load diff

View file

@ -1562,4 +1562,21 @@ void setPathTimestamp(bool dryRun, string inputPath, SysTime newTimeStamp) {
// display the error message
displayFileSystemErrorMessage(e.msg, getFunctionName!({}));
}
}
// Generate the initial function processing time log entry
void displayFunctionProcessingStart(string functionName, string logKey) {
// Output the function processing header
addLogEntry(format("[%s] Application Function '%s' Started", strip(logKey), strip(functionName)));
}
// Calculate the time taken to perform the application Function
void displayFunctionProcessingTime(string functionName, SysTime functionStartTime, SysTime functionEndTime, string logKey) {
// Calculate processing time
auto functionDuration = functionEndTime - functionStartTime;
double functionDurationAsSeconds = (functionDuration.total!"msecs"/1e3); // msec --> seconds
// Output the function processing time
string processingTime = format("[%s] Application Function '%s' Processing Time = %.4f Seconds", strip(logKey), strip(functionName), functionDurationAsSeconds);
addLogEntry(processingTime);
}