Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. How to get cpu speed and ram manufaturer C Languae?

How to get cpu speed and ram manufaturer C Languae?

Scheduled Pinned Locked Moved ATL / WTL / STL
performancetutorialquestion
2 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    Uzair Ahmad
    wrote on last edited by
    #1

    CPU Speed and RAM Manufacturer.

    A 1 Reply Last reply
    0
    • U Uzair Ahmad

      CPU Speed and RAM Manufacturer.

      A Offline
      A Offline
      Afzaal Ahmad Zeeshan
      wrote on last edited by
      #2

      Do not try to do that, natively. Instead, consider using the platform specific APIs, such as the Linux APIs for C or the Win32 API on Windows. The benefit is that you will be able to get the information, such as the information about hardware (I am not sure, whether you will be able to dig that much information or not). Start from somewhere like this, [How to get current CPU and RAM usage in C++? - Stack Overflow](https://stackoverflow.com/questions/479722/how-to-get-current-cpu-and-ram-usage-in-c) [sysinfo(2) - Linux manual page](http://man7.org/linux/man-pages/man2/sysinfo.2.html) You would then need to go on other platform APIs such as the Win32, and find out what is offered there. Such as, [GetSystemInfo function (Windows)](https://msdn.microsoft.com/en-us/library/ms724381(VS.85).aspx) will provide the system info for CPU. One thing is for sure: What works on Linux with C, is not going to work on Windows and vice versa. Also, none of this guarantees to provide CPU make, or RAM manufacturer name. In most cases, you will have to pull down a complete stream of data, and then parse it to extract the interested portion; such as in this post, [How to check processor and cpu details on Linux | Linux.com | The source for Linux information](https://www.linux.com/blog/how-check-processor-and-cpu-details-linux)

      $ cat /proc/cpuinfo | grep vendor | uniq
      vendor_id : GenuineIntel

      $ cat /proc/cpuinfo | grep 'model name' | uniq
      model name : Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz

      $ lscpu
      Architecture: x86_64

      Which shows, that you will have to extract and then parse the data to show the interested part; otherwise, that doesn't quite work that way. Good luck Googling. :-)

      The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups