public void Calculate() { Protein value = _proteinService.Get(SelectedProject); if (value == null) { return; } Protein protein = value.Copy(); if (PreferredDeadlineChecked) { protein.PreferredDays = PreferredDeadline; } if (FinalDeadlineChecked) { protein.MaximumDays = FinalDeadline; } if (KFactorChecked) { protein.KFactor = KFactor; } TimeSpan frameTime = TimeSpan.FromMinutes(TpfMinutes).Add(TimeSpan.FromSeconds(TpfSeconds)); TimeSpan totalTimeByFrame = TimeSpan.FromSeconds(frameTime.TotalSeconds * protein.Frames); TimeSpan totalTimeByUser = totalTimeByFrame; if (TotalWuTimeEnabled) { totalTimeByUser = TimeSpan.FromMinutes(TotalWuTimeMinutes).Add(TimeSpan.FromSeconds(TotalWuTimeSeconds)); // user time is less than total time by frame, not permitted if (totalTimeByUser < totalTimeByFrame) { totalTimeByUser = totalTimeByFrame; } } var decimalPlaces = _preferences.Get <int>(Preference.DecimalPlaces); var noBonus = protein.GetProteinProduction(frameTime, TimeSpan.Zero); var bonusByUserSpecifiedTime = protein.GetProteinProduction(frameTime, totalTimeByUser); var bonusByFrameTime = protein.GetProteinProduction(frameTime, totalTimeByFrame); CoreName = protein.Core; SlotType = ConvertToSlotType.FromCoreName(protein.Core).ToString(); NumberOfAtoms = protein.NumberOfAtoms; CompletionTime = Math.Round(TotalWuTimeEnabled ? totalTimeByUser.TotalDays : totalTimeByFrame.TotalDays, decimalPlaces); PreferredDeadline = protein.PreferredDays; FinalDeadline = protein.MaximumDays; KFactor = protein.KFactor; BonusMultiplier = Math.Round(TotalWuTimeEnabled ? bonusByUserSpecifiedTime.Multiplier : bonusByFrameTime.Multiplier, decimalPlaces); BaseCredit = noBonus.Credit; TotalCredit = Math.Round(TotalWuTimeEnabled ? bonusByUserSpecifiedTime.Credit : bonusByFrameTime.Credit, decimalPlaces); BasePpd = noBonus.PPD; TotalPpd = Math.Round(TotalWuTimeEnabled ? bonusByUserSpecifiedTime.PPD : bonusByFrameTime.PPD, decimalPlaces); }
public override object Invoke(object[] args) { Debug.Assert(args.Length == 1); if (args[0] == null || Convert.IsDBNull(args[0])) { return(String.Empty); } var core = (string)args[0]; return(String.IsNullOrEmpty(core) ? String.Empty : ConvertToSlotType.FromCoreName(core).ToString()); }
protected static string GetSlotNameAndProcessor(ProteinBenchmark benchmark, Protein protein) { if (protein != null) { var slotType = ConvertToSlotType.FromCoreName(protein.Core); var processorAndThreads = benchmark.BenchmarkIdentifier.ToProcessorAndThreadsString(slotType); if (!String.IsNullOrWhiteSpace(processorAndThreads)) { return(String.Join(" / ", benchmark.SlotIdentifier.Name, processorAndThreads)); } } return(benchmark.SlotIdentifier.Name); }
private static IEnumerable <string> EnumerateBenchmarkInformation(Protein protein, ProteinBenchmark benchmark, string numberFormat, bool calculateBonus) { yield return($" Name: {benchmark.SlotIdentifier.Name}"); yield return($" Path: {benchmark.SlotIdentifier.ClientIdentifier.ToServerPortString()}"); if (benchmark.BenchmarkIdentifier.HasProcessor) { var slotType = ConvertToSlotType.FromCoreName(protein.Core); yield return($" Proc: {benchmark.BenchmarkIdentifier.ToProcessorAndThreadsString(slotType)}"); } yield return($" Number of Frames Observed: {benchmark.FrameTimes.Count}"); yield return(String.Empty); yield return(String.Format(CultureInfo.InvariantCulture, " Min. Time / Frame : {0} - {1} PPD", benchmark.MinimumFrameTime, GetPPD(protein, benchmark.MinimumFrameTime, calculateBonus).ToString(numberFormat))); yield return(String.Format(CultureInfo.InvariantCulture, " Avg. Time / Frame : {0} - {1} PPD", benchmark.AverageFrameTime, GetPPD(protein, benchmark.AverageFrameTime, calculateBonus).ToString(numberFormat))); }