Open AlexGhiondea opened 7 years ago
@danmosemsft Ehm, I'm talking about the system total and system free memory, not the used memory by a single process. AFAIK this information is not available up to .NET Core 2.2, probably also not in 3.1. I could not find suitable Windows API functions. There's the Linux free
command to determine those. I'm especially interested in separate numbers for buffers/cache memory usage to determine the actual memory need, not including caches that fill up the free memory. Basically everything from here:
$ free -h
total used free shared buff/cache available
Mem: 15G 5.4G 726M 1.3G 9.2G 8.3G
Swap: 4.0G 100M 3.9G
CPU counters could be used to determine how much the CPU is currently used. In Linux there are different counters, available with iostat
:
avg-cpu: %user %nice %system %iowait %steal %idle
5.00 0.00 0.69 7.25 0.00 87.06
@ygoe oh of course - my bad.
OK, to make this issue concrete -- I think we need a concrete API proposal
@richlander you have spent a lot of time thinking about the memory and CPU counters that the runtime itself should read (for example, to properly respect limits on a container). Any thoughts here?
GC.GetGCMemoryInfo
is the (container-aware) API added in 3.0 that returns memory details about memory used and available.
GetGCMemoryInfo doesn't sound like it would return system-wide data.
Returning non-virtualized system-wide data does not make sense in containers.
Yeah, but I'm not using containers. 😉 I'm fully aware that inside containers you have a very limited view on the host system.
@jkotas: that is really on a case-by-case basis, no? CPU manufacturer and cache layout, for example, make a lot of sense and remain constant for all cases (unless the virtualization engine is lying to you by emulating CPUID), while the more often virtualized properties have to be the virtualized/containerized versions too.
Specifically, CPU topology and memory would have to be container aware. Virtualization is already good at exposing the virtual values through the normal "APIs". It would take herculean efforts to read/access the physical/host properties in a virtualized system.
Some of my projects are planning to be hosted in Linux but I can't get the hardware info. Is there any update on this? or anybody will be working on this? I find java they have oshi but all net core are talking about the "RuntimeInformation"
Some of my projects are planning to be hosted in Linux but I can't get the hardware info. Is there any update on this? or anybody will be working on this? I find java they have oshi but all net core are talking about the "RuntimeInformation"
At the current time you have to be specific about what hardware information currently you requires. There are limited support and some workaround as listed above which can be used scenario by scenario
@KamranShahid
I think you will find partial overlap between what you want and what WILL be provided in: https://github.com/dotnet/runtime/issues/785
@KamranShahid the specific hardwares are cpu, disk, network, board, memory, the information include the name, unique id, manufacture or some other infomations wihch like the WMI can provided before. some of the product require a license based on the hardware and now we need to rewrite this in C++ insead of .net core.
find this MatthewKing/DeviceId
@KamranShahid the specific hardwares are cpu, disk, network, board, memory, the information include the name, unique id, manufacture or some other infomations wihch like the WMI can provided before. some of the product require a license based on the hardware and now we need to rewrite this in C++ insead of .net core.
It s up-to you. Mine problem was solved as per above hack that time
I find the following names ambiguous, is this indicating the cache exists? it's size and if so what metric. (Potentially only comments but a better name would also help)
public int FirstLevelCacheSize { get; protected set; }
public int SecondLevelCache { get; protected set; }
public int ThirdLevelCache { get; protected set; }
What I am mainly looking for out of this is an easy way to determine when tis best to ATTEMPT to go parallel, see https://github.com/dotnet/runtime/issues/37602 for further info.
Thank you for your time!
It 's a long time for looking forwart this function.
Even if somebody point me to third party nuget package then it will also be helpful
@KamranShahid My attempt at cross platform hardware info: https://github.com/Jinjinov/Hardware.Info
As noted above the next step here is for someone passionate to reach consensus among those interested on a formal proposal following the template. My suggestion is to do this in increments, starting with a proposal for the most key part - maybe that's cache size. It may be clearer to create that as a new issue, following that template.
Even if somebody point me to third party nuget package then it will also be helpful
@KamranShahid My attempt at cross platform hardware info: https://github.com/Jinjinov/Hardware.Info
Thank you
@heartlocker commented on Mon Jul 24 2017
As the .NET Core project could run on Windows, Linux and Mac OS. Is it possible for me to get the PhysicalMemory size of the running machine on these three OS. Just like in .NET framework, by using
Microsoft.VisualBasic.Devices.ComputerInfo
to get the Physical Memory information of the windows machine@Petermarcu commented on Wed Jul 26 2017
@AlexGhiondea , should this issue be moved to CoreFX to make an API proposal?
@AlexGhiondea commented on Wed Jul 26 2017
@Petermarcu yes -- I will move it.