/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Class != null) { hashCode = hashCode * 59 + Class.GetHashCode(); } if (DisplayName != null) { hashCode = hashCode * 59 + DisplayName.GetHashCode(); } if (Executors != null) { hashCode = hashCode * 59 + Executors.GetHashCode(); } if (Icon != null) { hashCode = hashCode * 59 + Icon.GetHashCode(); } if (IconClassName != null) { hashCode = hashCode * 59 + IconClassName.GetHashCode(); } hashCode = hashCode * 59 + Idle.GetHashCode(); hashCode = hashCode * 59 + JnlpAgent.GetHashCode(); hashCode = hashCode * 59 + LaunchSupported.GetHashCode(); if (LoadStatistics != null) { hashCode = hashCode * 59 + LoadStatistics.GetHashCode(); } hashCode = hashCode * 59 + ManualLaunchAllowed.GetHashCode(); if (MonitorData != null) { hashCode = hashCode * 59 + MonitorData.GetHashCode(); } hashCode = hashCode * 59 + NumExecutors.GetHashCode(); hashCode = hashCode * 59 + Offline.GetHashCode(); if (OfflineCause != null) { hashCode = hashCode * 59 + OfflineCause.GetHashCode(); } if (OfflineCauseReason != null) { hashCode = hashCode * 59 + OfflineCauseReason.GetHashCode(); } hashCode = hashCode * 59 + TemporarilyOffline.GetHashCode(); return(hashCode); } }
public static LoadStatistics GetLoadStatistics() { var result = new LoadStatistics(); var totalProcessorTimeCounterPercent = new PerformanceCounter("Processor", "% Processor Time", "_Total"); var freeRamCounterMB = new PerformanceCounter("Memory", "Available MBytes"); var usedRamCounterPercent = new PerformanceCounter("Memory", "% Committed Bytes In Use"); totalProcessorTimeCounterPercent.NextValue(); freeRamCounterMB.NextValue(); usedRamCounterPercent.NextValue(); System.Threading.Thread.Sleep(1000); // 1 second wait result.TotalProcessorTimeCounterPercent = totalProcessorTimeCounterPercent.NextValue(); result.FreeRamCounterMB = freeRamCounterMB.NextValue(); result.UsedRamCounterPercent = usedRamCounterPercent.NextValue(); return result; }
/// <summary> /// Returns true if HudsonMasterComputer instances are equal /// </summary> /// <param name="other">Instance of HudsonMasterComputer to be compared</param> /// <returns>Boolean</returns> public bool Equals(HudsonMasterComputer other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( DisplayName == other.DisplayName || DisplayName != null && DisplayName.Equals(other.DisplayName) ) && ( Executors == other.Executors || Executors != null && Executors.SequenceEqual(other.Executors) ) && ( Icon == other.Icon || Icon != null && Icon.Equals(other.Icon) ) && ( IconClassName == other.IconClassName || IconClassName != null && IconClassName.Equals(other.IconClassName) ) && ( Idle == other.Idle || Idle != null && Idle.Equals(other.Idle) ) && ( JnlpAgent == other.JnlpAgent || JnlpAgent != null && JnlpAgent.Equals(other.JnlpAgent) ) && ( LaunchSupported == other.LaunchSupported || LaunchSupported != null && LaunchSupported.Equals(other.LaunchSupported) ) && ( LoadStatistics == other.LoadStatistics || LoadStatistics != null && LoadStatistics.Equals(other.LoadStatistics) ) && ( ManualLaunchAllowed == other.ManualLaunchAllowed || ManualLaunchAllowed != null && ManualLaunchAllowed.Equals(other.ManualLaunchAllowed) ) && ( MonitorData == other.MonitorData || MonitorData != null && MonitorData.Equals(other.MonitorData) ) && ( NumExecutors == other.NumExecutors || NumExecutors != null && NumExecutors.Equals(other.NumExecutors) ) && ( Offline == other.Offline || Offline != null && Offline.Equals(other.Offline) ) && ( OfflineCause == other.OfflineCause || OfflineCause != null && OfflineCause.Equals(other.OfflineCause) ) && ( OfflineCauseReason == other.OfflineCauseReason || OfflineCauseReason != null && OfflineCauseReason.Equals(other.OfflineCauseReason) ) && ( TemporarilyOffline == other.TemporarilyOffline || TemporarilyOffline != null && TemporarilyOffline.Equals(other.TemporarilyOffline) )); }
private void statistics_Click(object sender, EventArgs e) { LoadStatistics?.Invoke(this, EventArgs.Empty); }