/// <summary> /// Time per frame (TPF) of the unit /// </summary> public TimeSpan GetFrameTime(PpdCalculationType calculationType) { int rawTime = GetRawTime(calculationType); if (rawTime != 0) { return(TimeSpan.FromSeconds(rawTime)); } var benchmark = _benchmarkService?.GetBenchmark(UnitInfoData); return(benchmark?.AverageFrameTime ?? TimeSpan.Zero); }
public void ShowPPDTrace(ILogger logger, string slotName, SlotStatus status, PpdCalculationType calculationType, BonusCalculationType bonusCalculationType) { // test the level if (!logger.IsDebugEnabled) { return; } if (CurrentProtein.IsUnknown) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Protein is unknown... 0 PPD."); return; } // Issue 125 if (bonusCalculationType == BonusCalculationType.DownloadTime) { // Issue 183 if (status.Equals(SlotStatus.RunningAsync) || status.Equals(SlotStatus.RunningNoFrameTimes)) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Download Time."); } } else if (bonusCalculationType == BonusCalculationType.FrameTime) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Standard PPD."); } TimeSpan frameTime = GetFrameTime(calculationType); var values = ProductionCalculator.GetProductionValues(frameTime, CurrentProtein, GetEftByDownloadTime(frameTime), GetEftByFrameTime(frameTime)); logger.DebugFormat(" - {0}", UnitInfoData.ToProjectString()); logger.Debug(values.ToMultiLineString()); }
/// <summary> /// Frame Time per section based on current PPD calculation setting (readonly) /// </summary> public int GetRawTime(PpdCalculationType calculationType) { switch (calculationType) { case PpdCalculationType.LastFrame: return(_unitInfo.FramesObserved > 1 ? Convert.ToInt32(_unitInfo.CurrentFrame.Duration.TotalSeconds) : 0); case PpdCalculationType.LastThreeFrames: return(_unitInfo.FramesObserved > 3 ? GetDurationInSeconds(3) : 0); case PpdCalculationType.AllFrames: return(_unitInfo.FramesObserved > 0 ? GetDurationInSeconds(_unitInfo.FramesObserved) : 0); case PpdCalculationType.EffectiveRate: return(GetRawTimePerUnitDownload()); } return(0); }
/// <summary> /// Time per frame (TPF) of the unit /// </summary> public TimeSpan GetFrameTime(PpdCalculationType calculationType) { int rawTime = GetRawTime(calculationType); if (rawTime != 0) { return(TimeSpan.FromSeconds(rawTime)); } // Issue 79 - no benchmark container is available to merged display instances if (_benchmarkService != null) { ProteinBenchmark benchmark = _benchmarkService.GetBenchmark(UnitInfoData); if (benchmark != null) { return(benchmark.AverageFrameTime); } } return(TimeSpan.Zero); }
/// <summary> /// Units per day (UPD) rating for this unit /// </summary> public double GetUPD(PpdCalculationType calculationType) { return(ProductionCalculator.GetUPD(GetFrameTime(calculationType), CurrentProtein.Frames)); }
public bool IsUsingBenchmarkFrameTime(PpdCalculationType calculationType) { return(GetRawTime(calculationType) == 0); }
/// <summary> /// Esimated time of arrival (ETA) for this unit /// </summary> public TimeSpan GetEta(PpdCalculationType calculationType) { return GetEta(GetFrameTime(calculationType)); }
/// <summary> /// Estimated time of arrival (ETA) for this unit /// </summary> public DateTime GetEtaDate(PpdCalculationType calculationType) { return(_unitInfo.UnitRetrievalTime.Add(GetEta(calculationType))); }
public void ShowPPDTrace(ILogger logger, string slotName, SlotStatus status, PpdCalculationType calculationType, BonusCalculationType calculateBonus) { // test the level if (!logger.IsDebugEnabled) return; if (CurrentProtein.IsUnknown()) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Protein is unknown... 0 PPD."); return; } // Issue 125 if (calculateBonus.Equals(BonusCalculationType.DownloadTime)) { // Issue 183 if (status.Equals(SlotStatus.RunningAsync) || status.Equals(SlotStatus.RunningNoFrameTimes)) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Download Time."); } } else if (calculateBonus.Equals(BonusCalculationType.FrameTime)) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Standard PPD."); } TimeSpan frameTime = GetFrameTime(calculationType); var values = CurrentProtein.GetProductionValues(frameTime, GetEftByDownloadTime(frameTime), GetEftByFrameTime(frameTime), calculateBonus.IsEnabled()); logger.Debug(values.ToMultiLineString()); }
public bool IsUsingBenchmarkFrameTime(PpdCalculationType calculationType) { return GetRawTime(calculationType) == 0; }
/// <summary> /// Units per day (UPD) rating for this unit /// </summary> public double GetUPD(PpdCalculationType calculationType) { return CurrentProtein.GetUPD(GetFrameTime(calculationType)); }
/// <summary> /// Frame Time per section based on current PPD calculation setting (readonly) /// </summary> public int GetRawTime(PpdCalculationType calculationType) { switch (calculationType) { case PpdCalculationType.LastFrame: return _unitInfo.FramesObserved > 1 ? Convert.ToInt32(_unitInfo.CurrentFrame.FrameDuration.TotalSeconds) : 0; case PpdCalculationType.LastThreeFrames: return _unitInfo.FramesObserved > 3 ? GetDurationInSeconds(3) : 0; case PpdCalculationType.AllFrames: return _unitInfo.FramesObserved > 0 ? GetDurationInSeconds(_unitInfo.FramesObserved) : 0; case PpdCalculationType.EffectiveRate: return GetRawTimePerUnitDownload(); } return 0; }
/// <summary> /// Points per day (PPD) rating for this unit /// </summary> public double GetPPD(SlotStatus status, PpdCalculationType calculationType, BonusCalculationType calculateBonus) { TimeSpan frameTime = GetFrameTime(calculationType); return GetPPD(frameTime, GetEftByDownloadTime(frameTime), GetEftByFrameTime(frameTime), status, calculateBonus); }
/// <summary> /// Time per frame (TPF) of the unit /// </summary> public TimeSpan GetFrameTime(PpdCalculationType calculationType) { int rawTime = GetRawTime(calculationType); if (rawTime != 0) { return TimeSpan.FromSeconds(rawTime); } // Issue 79 - no benchmark container is available to merged display instances if (_benchmarkCollection != null) { ProteinBenchmark benchmark = _benchmarkCollection.GetBenchmark(UnitInfoData); if (benchmark != null) { return benchmark.AverageFrameTime; } } return TimeSpan.Zero; }
/// <summary> /// Esimated time of arrival (ETA) for this unit /// </summary> public DateTime GetEtaDate(PpdCalculationType calculationType) { return _unitInfo.UnitRetrievalTime.Add(GetEta(calculationType)); }
/// <summary> /// Points per day (PPD) rating for this unit /// </summary> public double GetPPD(SlotStatus status, PpdCalculationType calculationType, BonusCalculationType calculateBonus) { TimeSpan frameTime = GetFrameTime(calculationType); return(GetPPD(frameTime, GetUnitTimeByDownloadTime(frameTime), GetUnitTimeByFrameTime(frameTime), status, calculateBonus)); }
/// <summary> /// Estimated time of arrival (ETA) for this unit /// </summary> public TimeSpan GetEta(PpdCalculationType calculationType) { return(GetEta(GetFrameTime(calculationType))); }
/// <summary> /// Work unit credit /// </summary> public double GetCredit(SlotStatus status, PpdCalculationType calculationType, BonusCalculationType calculateBonus) { TimeSpan frameTime = GetFrameTime(calculationType); return(GetCredit(GetEftByDownloadTime(frameTime), GetEftByFrameTime(frameTime), status, calculateBonus)); }
public void ShowProductionTrace(ILogger logger, string slotName, SlotStatus status, PpdCalculationType calculationType, BonusCalculationType bonusCalculationType) { // test the level if (!logger.IsDebugEnabled) { return; } if (CurrentProtein.IsUnknown()) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Protein is unknown... 0 PPD."); return; } switch (bonusCalculationType) { case BonusCalculationType.DownloadTime: logger.DebugFormat(Constants.ClientNameFormat, slotName, status == SlotStatus.RunningNoFrameTimes ? "Calculate Bonus PPD by Frame Time." : "Calculate Bonus PPD by Download Time."); break; case BonusCalculationType.FrameTime: logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); break; default: logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Standard PPD."); break; } TimeSpan frameTime = GetFrameTime(calculationType); var noBonusValues = CurrentProtein.GetProductionValues(frameTime, TimeSpan.Zero); TimeSpan unitTimeByDownloadTime = GetUnitTimeByDownloadTime(frameTime); var bonusByDownloadValues = CurrentProtein.GetProductionValues(frameTime, unitTimeByDownloadTime); TimeSpan unitTimeByFrameTime = GetUnitTimeByFrameTime(frameTime); var bonusByFrameValues = CurrentProtein.GetProductionValues(frameTime, unitTimeByFrameTime); logger.Debug(CreateProductionDebugOutput(UnitInfoData.ToShortProjectString(), frameTime, CurrentProtein, noBonusValues, unitTimeByDownloadTime, bonusByDownloadValues, unitTimeByFrameTime, bonusByFrameValues)); }
/// <summary> /// Units per day (UPD) rating for this unit /// </summary> public double GetUPD(PpdCalculationType calculationType) { return ProductionCalculator.GetUPD(GetFrameTime(calculationType), CurrentProtein.Frames); }