Coder Social home page Coder Social logo

Comments (6)

antondelsink avatar antondelsink commented on June 6, 2024

If you're open to a platform-specific option, WMI may yield enough info. An example from PowerShell:
Get-WmiObject -Class Win32_Processor | fl
or
Get-WmiObject -Class Win32_Processor | Get-Member
Some of the available data:

  • CurrentClockSpeed
  • L2CacheSize
  • L2CacheSpeed
  • L3CacheSize
  • L3CacheSpeed
  • NumberOfCores
  • NumberOfEnabledCore
  • NumberOfLogicalProcessors
  • Stepping,
    etc.

We can get WMI data via Microsoft.Management.Infrastructure, if you're open to that...

from nbench.

Aaronontheweb avatar Aaronontheweb commented on June 6, 2024

@antondelsink I'm open to platform-specific tooling here, although here's the catch: we have to make it switchable underneath so the core NBench library can appear to be platform-agnostic. This is an absolute must-have for supporting .NET Core in the future.

So here's what I propose: we create a provider model for SysInfo which will lazily load one of three possible SysInfo concrete implementations:

  1. The generalized, "safe" default one we have now;
  2. A Windows-specific WMI provider; and
  3. A to-be-announced Linux / Posix-specific provider.

Provider 1 is included in the default NBench library, and it's always the fallback in the event that implementations 2 or 3 fail to load or aren't available.

Implementations 2 and 3 will be implemented in external DLLs, so NBench.SysInfo.Windows and NBench.SysInfo.Linux perhaps.

At runtime, we'll detect the OS and Assembly.Load the appropriate implementation and then that that SysInfo object as the data provider going forward. If any part of that operation fails, fall back to Provider 1 and continue.

We'll also need to expand the fields on the SysInfo object to include this additional data too. Maybe it's better to just have a dictionary of properties we can populate rather than a bunch of static fields.

What do you think @antondelsink ?

from nbench.

antondelsink avatar antondelsink commented on June 6, 2024

Assembly.Load would work... also consider a Conditional on the reference to the library NBench.SysInfo.Windows so the decision is made at time of build, perhaps with the default build providing only the "safe" default SysInfo.

from nbench.

antondelsink avatar antondelsink commented on June 6, 2024

I'll put together a naïve NBench.SysInfo.Windows.WMI class in a new project under the same solution, but @Aaronontheweb tell me more about how you would like to load it. Perhaps from the current SysInfo.CreateInstance?

from nbench.

antondelsink avatar antondelsink commented on June 6, 2024

@Aaronontheweb: take a look at #109; I've also added:

  • Get-WmiObject -Class Win32_PhysicalMemory
  • Get-WmiObject -Class Win32_BIOS

from nbench.

antondelsink avatar antondelsink commented on June 6, 2024

Hi @Aaronontheweb, still interested in this?

from nbench.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.