/// <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 (AvailablePhysicalMemory != null) { hashCode = hashCode * 59 + AvailablePhysicalMemory.GetHashCode(); } if (AvailableSwapSpace != null) { hashCode = hashCode * 59 + AvailableSwapSpace.GetHashCode(); } if (TotalPhysicalMemory != null) { hashCode = hashCode * 59 + TotalPhysicalMemory.GetHashCode(); } if (TotalSwapSpace != null) { hashCode = hashCode * 59 + TotalSwapSpace.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the statistics of the machine, including CPU% and RAM /// </summary> public static Dictionary <string, string> GetServerStatistics() { return(new Dictionary <string, string> { { "CPU Usage", CpuUsage.NextValue().ToString("0.0") + "%" }, { "Used RAM (MB)", TotalPhysicalMemoryUsed.ToString() }, { "Total RAM (MB)", TotalPhysicalMemory.ToString() }, { "Used Disk Space (MB)", DriveSpaceUsed.ToString() }, { "Total Disk Space (MB)", DriveTotalSpace.ToString() } }); }
/// <summary> /// Gets the statistics of the machine, including CPU% and RAM /// </summary> public static Dictionary <string, string> GetServerStatistics() { return(new Dictionary <string, string> { { "CPU Usage", CpuUsage.NextValue().ToString("0.0") + "%" }, { "Used RAM (MB)", TotalPhysicalMemoryUsed.ToString() }, { "Total RAM (MB)", TotalPhysicalMemory.ToString() }, { "Used Disk Space (MB)", DriveSpaceUsed.ToString() }, { "Total Disk Space (MB)", DriveTotalSpace.ToString() }, { "Hostname", Environment.MachineName }, { "LEAN Version", "v" + Globals.Version } }); }
public override int GetHashCode() { unchecked { var hashCode = ProcessorCount; hashCode = (hashCode * 397) ^ TotalPhysicalMemory.GetHashCode(); hashCode = (hashCode * 397) ^ (CommandLine?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProcessId?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Architecture?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OSName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (OSVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (IpAddress?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (MachineName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (InstallId?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RuntimeVersion?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Data?.GetCollectionHashCode() ?? 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = ProcessorCount; hashCode = (hashCode * 397) ^ TotalPhysicalMemory.GetHashCode(); hashCode = (hashCode * 397) ^ (CommandLine == null ? 0 : CommandLine.GetHashCode()); hashCode = (hashCode * 397) ^ (ProcessName == null ? 0 : ProcessName.GetHashCode()); hashCode = (hashCode * 397) ^ (ProcessId == null ? 0 : ProcessId.GetHashCode()); hashCode = (hashCode * 397) ^ (Architecture == null ? 0 : Architecture.GetHashCode()); hashCode = (hashCode * 397) ^ (OSName == null ? 0 : OSName.GetHashCode()); hashCode = (hashCode * 397) ^ (OSVersion == null ? 0 :OSVersion.GetHashCode()); hashCode = (hashCode * 397) ^ (IpAddress == null ? 0 : IpAddress.GetHashCode()); hashCode = (hashCode * 397) ^ (MachineName == null ? 0 : MachineName.GetHashCode()); hashCode = (hashCode * 397) ^ (InstallId == null ? 0 : InstallId.GetHashCode()); hashCode = (hashCode * 397) ^ (RuntimeVersion == null ? 0 : RuntimeVersion.GetHashCode()); hashCode = (hashCode * 397) ^ (Data == null ? 0 : Data.GetCollectionHashCode()); return(hashCode); } }
public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(nameof(ConfigurationModel)); sb.AppendLine($"- {nameof(IsValid)} = " + IsValid); sb.AppendLine($"- {nameof(UnicastNodes)} = " + string.Join(", ", UnicastNodes)); sb.AppendLine($"- {nameof(ClusterName)} = " + ClusterName); sb.AppendLine($"- {nameof(NodeName)} = " + NodeName); sb.AppendLine($"- {nameof(MasterNode)} = " + MasterNode); sb.AppendLine($"- {nameof(DataNode)} = " + DataNode); sb.AppendLine($"- {nameof(IngestNode)} = " + IngestNode); sb.AppendLine($"- {nameof(TotalPhysicalMemory)} = " + TotalPhysicalMemory.ToString(CultureInfo.InvariantCulture)); sb.AppendLine($"- {nameof(SelectedMemory)} = " + SelectedMemory.ToString(CultureInfo.InvariantCulture)); sb.AppendLine($"- {nameof(MinimumMasterNodes)} = " + MinimumMasterNodes.ToString(CultureInfo.InvariantCulture)); sb.AppendLine($"- {nameof(LockMemory)} = " + LockMemory); sb.AppendLine($"- {nameof(NetworkHost)} = " + NetworkHost); sb.AppendLine($"- {nameof(HttpPort)} = " + HttpPort); sb.AppendLine($"- {nameof(TransportPort)} = " + TransportPort); return(sb.ToString()); }
/// <summary> /// Returns true if SwapSpaceMonitorMemoryUsage2 instances are equal /// </summary> /// <param name="other">Instance of SwapSpaceMonitorMemoryUsage2 to be compared</param> /// <returns>Boolean</returns> public bool Equals(SwapSpaceMonitorMemoryUsage2 other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( AvailablePhysicalMemory == other.AvailablePhysicalMemory || AvailablePhysicalMemory.Equals(other.AvailablePhysicalMemory) ) && ( AvailableSwapSpace == other.AvailableSwapSpace || AvailableSwapSpace.Equals(other.AvailableSwapSpace) ) && ( TotalPhysicalMemory == other.TotalPhysicalMemory || TotalPhysicalMemory.Equals(other.TotalPhysicalMemory) ) && ( TotalSwapSpace == other.TotalSwapSpace || TotalSwapSpace.Equals(other.TotalSwapSpace) )); }