Created
August 21, 2020 20:01
-
-
Save timheuer/91c33cc49d8e8e063fb453a131a7568a to your computer and use it in GitHub Desktop.
modified for rich
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<LangVersion>preview</LangVersion> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
</PropertyGroup> | |
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
using static System.Console; | |
WriteLine("**.NET information"); | |
WriteLine($"{nameof(Environment.Version)}: {Environment.Version}"); | |
WriteLine($"{nameof(RuntimeInformation.FrameworkDescription)}: {RuntimeInformation.FrameworkDescription}"); | |
WriteLine($"Libraries version: {((AssemblyInformationalVersionAttribute[])typeof(object).Assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute),false))[0].InformationalVersion.Split('+')[0]}"); | |
WriteLine($"Libraries hash: {((AssemblyInformationalVersionAttribute[])typeof(object).Assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false))[0].InformationalVersion.Split('+')[1]}"); | |
WriteLine(); | |
WriteLine("**Environment information"); | |
WriteLine($"{nameof(RuntimeInformation.OSDescription)}: {RuntimeInformation.OSDescription}"); | |
WriteLine($"{nameof(Environment.OSVersion)}: {Environment.OSVersion}"); | |
WriteLine($"{nameof(RuntimeInformation.OSArchitecture)}: {RuntimeInformation.OSArchitecture}"); | |
WriteLine($"{nameof(Environment.ProcessorCount)}: {Environment.ProcessorCount}"); | |
WriteLine(); | |
if(RuntimeInformation.OSDescription.StartsWith("Linux") && Directory.Exists("/sys/fs/cgroup")) | |
{ | |
WriteLine("**CGroup info**"); | |
WriteLine($"cfs_quota_us: {System.IO.File.ReadAllLines("/sys/fs/cgroup/cpu/cpu.cfs_quota_us")[0]}"); | |
WriteLine($"memory.limit_in_bytes: {System.IO.File.ReadAllLines("/sys/fs/cgroup/memory/memory.limit_in_bytes")[0]}"); | |
WriteLine($"memory.usage_in_bytes: {System.IO.File.ReadAllLines("/sys/fs/cgroup/memory/memory.usage_in_bytes")[0]}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment