aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2021-03-22 14:21:51 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2021-03-22 14:21:51 +0200
commit21fb72e7d63518adbe816f871c44b2929926bd10 (patch)
treee65f54a41c55f9b5eeca0a45fd64af33c94c6d5d /Software/Visual_Studio/Tango.Integration
parent6ccd2ee79d33669baea3d5d49b3fc5597e32d177 (diff)
downloadTango-21fb72e7d63518adbe816f871c44b2929926bd10.tar.gz
Tango-21fb72e7d63518adbe816f871c44b2929926bd10.zip
JobHandler unit calc optimization.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration')
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs53
1 files changed, 27 insertions, 26 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs
index 342bc01e3..a8208323a 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs
@@ -26,7 +26,6 @@ namespace Tango.Integration.Operation
protected double _last_progress;
protected const int PROGRESS_REPORT_RANGE_METERS = 5;
protected bool loggedContinueMessage;
- private static int _handlerCounter;
#region Events
@@ -149,7 +148,6 @@ namespace Tango.Integration.Operation
public JobHandler()
{
CanCancel = true;
- _handlerCounter++;
}
/// <summary>
@@ -335,15 +333,15 @@ namespace Tango.Integration.Operation
if (_last_progress != s.Progress)
{
- //if (s.Progress <= PROGRESS_REPORT_RANGE_METERS || s.Progress >= Status.TotalProgress - PROGRESS_REPORT_RANGE_METERS)
- //{
- LogManager.Log($"{GetJobHandlerString()} Updating job progress {s.Progress}/{Status.TotalProgress}...");
- //}
- //else if (!loggedContinueMessage)
- //{
- // loggedContinueMessage = true;
- // LogManager.Log($"Progress logging will continue {PROGRESS_REPORT_RANGE_METERS} meters before completion...");
- //}
+ if (s.Progress <= PROGRESS_REPORT_RANGE_METERS || s.Progress >= Status.TotalProgress - PROGRESS_REPORT_RANGE_METERS)
+ {
+ LogManager.Log($"Updating job progress {s.Progress}/{Status.TotalProgress}...");
+ }
+ else if (!loggedContinueMessage)
+ {
+ loggedContinueMessage = true;
+ LogManager.Log($"Progress logging will continue {PROGRESS_REPORT_RANGE_METERS} meters before completion...");
+ }
}
if (s.Progress < 0)
@@ -393,17 +391,21 @@ namespace Tango.Integration.Operation
Status.ProgressWithoutFinalization = s.Progress;
unit_segments = _effectiveSegments.ToList();
- Status.CurrentUnitProgress = 0.0;
double previousUnitsLengthWithoutThis = 0.0;
+
+ int currentUnit = Status.CurrentUnit;
+ double currentUnitProgress = Status.CurrentUnitProgress;
+ double jobLength = Job.Length;
+
for (int index = 0; index < units; ++index)
{
- Status.CurrentUnit = index;
- double unitLength = !Job.EnableInterSegment || index >= units - 1 ? Job.Length : Job.Length + Job.InterSegmentLength;
+ currentUnit = index;
+ double unitLength = !Job.EnableInterSegment || index >= units - 1 ? jobLength : jobLength + Job.InterSegmentLength;
if (_mode == JobHandlerModes.Finalization)
{
if (s.Progress < unitLength + previousUnitsLengthWithoutThis)
{
- Status.CurrentUnitProgress = s.Progress - previousUnitsLengthWithoutThis;
+ currentUnitProgress = s.Progress - previousUnitsLengthWithoutThis;
break;
}
}
@@ -411,13 +413,17 @@ namespace Tango.Integration.Operation
{
if (!Status.IsSettingUp)
{
- Status.CurrentUnitProgress = s.Progress - previousUnitsLengthWithoutThis - this.Status.SettingUpProgress;
+ currentUnitProgress = s.Progress - previousUnitsLengthWithoutThis - this.Status.SettingUpProgress;
break;
}
break;
}
previousUnitsLengthWithoutThis += unitLength;
}
+
+ Status.CurrentUnit = currentUnit;
+ Status.CurrentUnitProgress = currentUnitProgress;
+
Status.RemainingUnits = this.Job.NumberOfUnits - this.Status.CurrentUnit;
if (Job.EnableInterSegment && Job.NumberOfUnits > 1 && Status.RemainingUnits > 1)
@@ -580,11 +586,11 @@ namespace Tango.Integration.Operation
{
if (segment.IsInterSegment)
{
- LogManager.Log($"{GetJobHandlerString()} Inter Segment started.");
+ LogManager.Log($"Inter Segment started.");
}
else
{
- LogManager.Log($"{GetJobHandlerString()} Segment {segment.SegmentIndex} of unit {Status.CurrentUnit + 1} started...");
+ LogManager.Log($"Segment {segment.SegmentIndex} of unit {Status.CurrentUnit + 1} started...");
}
SegmentStarted?.Invoke(this, segment);
@@ -594,18 +600,18 @@ namespace Tango.Integration.Operation
{
if (segment.IsInterSegment)
{
- LogManager.Log($"{GetJobHandlerString()} Inter Segment completed.");
+ LogManager.Log($"Inter Segment completed.");
}
else
{
- LogManager.Log($"{GetJobHandlerString()} Segment {segment.SegmentIndex} of unit {Status.CurrentUnit + 1} completed.");
+ LogManager.Log($"Segment {segment.SegmentIndex} of unit {Status.CurrentUnit + 1} completed.");
}
SegmentCompleted?.Invoke(this, segment);
}
protected void RaiseUnitCompleted(int unit)
{
- LogManager.Log($"{GetJobHandlerString()} Unit {unit + 1} completed...");
+ LogManager.Log($"Unit {unit + 1} completed...");
UnitCompleted?.Invoke(this, unit);
}
@@ -615,11 +621,6 @@ namespace Tango.Integration.Operation
Finalizing?.Invoke(this, new EventArgs());
}
- protected String GetJobHandlerString()
- {
- return $"JobHandler {_handlerCounter}:";
- }
-
#endregion
#region Public Methods