Skip to content

Commit

Permalink
Introduce HostName to EnvironmentInfo. (#4550)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaliyaudagedara authored Apr 19, 2023
1 parent 5b6ea97 commit 3bbd0b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion samples/aspnetapp/aspnetapp/EnvironmentInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Net;
using System.Runtime.InteropServices;

public struct EnvironmentInfo
Expand Down Expand Up @@ -38,10 +39,10 @@ public EnvironmentInfo()
public long TotalAvailableMemoryBytes { get; }
public long MemoryLimit { get; }
public long MemoryUsage { get; }
public string HostName => Dns.GetHostName();

private static long GetBestValue(string[] paths)
{
string value = string.Empty;
foreach (string path in paths)
{
if (Path.Exists(path) &&
Expand Down
4 changes: 3 additions & 1 deletion samples/dotnetapp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net;
using System.Runtime.InteropServices;
using static System.Console;

Expand Down Expand Up @@ -55,6 +56,7 @@ 8b 42 8b d8 42 42 42 8PP!!!!!!! 42
WriteLine($"{nameof(RuntimeInformation.OSArchitecture)}: {RuntimeInformation.OSArchitecture}");
WriteLine($"{nameof(Environment.ProcessorCount)}: {Environment.ProcessorCount}");
WriteLine($"{nameof(GCMemoryInfo.TotalAvailableMemoryBytes)}: {totalMemoryBytes} ({GetInBestUnit(totalMemoryBytes)})");
WriteLine($"HostName : {Dns.GetHostName()}");

string[] memoryLimitPaths = new string[]
{
Expand Down

0 comments on commit 3bbd0b1

Please sign in to comment.