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. C / C++ / MFC
  4. Get Number of Logical Processors

Get Number of Logical Processors

Scheduled Pinned Locked Moved C / C++ / MFC
questionjson
6 Posts 3 Posters 0 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.
  • N Offline
    N Offline
    Nathan Blomquist
    wrote on last edited by
    #1

    Is there a way to get the number of logical processors in a Windows XP system? If I see that the application is running on Windows XP and that hyperthreading is enabled (how do I do that?) I guess I could just divide by two? Are there any api calls for this? I found something about GetLogicalProcessorInformation, but that didn't seem to be what I need. Thanks, Nathan --------------------------- Hmmm... what's a signature?

    V B N 3 Replies Last reply
    0
    • N Nathan Blomquist

      Is there a way to get the number of logical processors in a Windows XP system? If I see that the application is running on Windows XP and that hyperthreading is enabled (how do I do that?) I guess I could just divide by two? Are there any api calls for this? I found something about GetLogicalProcessorInformation, but that didn't seem to be what I need. Thanks, Nathan --------------------------- Hmmm... what's a signature?

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      What is the difference between normal CPU and logical CPU? One solution is GetSystemInfo(). Kuphryn

      N 1 Reply Last reply
      0
      • N Nathan Blomquist

        Is there a way to get the number of logical processors in a Windows XP system? If I see that the application is running on Windows XP and that hyperthreading is enabled (how do I do that?) I guess I could just divide by two? Are there any api calls for this? I found something about GetLogicalProcessorInformation, but that didn't seem to be what I need. Thanks, Nathan --------------------------- Hmmm... what's a signature?

        B Offline
        B Offline
        basementman
        wrote on last edited by
        #3

        Try GetSystemInfo. I believe that the SYSTEM_INFO.dwNumberOfProcessors returns the number of logical processors (although I could be wrong).  onwards and upwards...

        N 1 Reply Last reply
        0
        • B basementman

          Try GetSystemInfo. I believe that the SYSTEM_INFO.dwNumberOfProcessors returns the number of logical processors (although I could be wrong).  onwards and upwards...

          N Offline
          N Offline
          Nathan Blomquist
          wrote on last edited by
          #4

          see answer to kuphryn... --------------------------- Hmmm... what's a signature?

          1 Reply Last reply
          0
          • V valikac

            What is the difference between normal CPU and logical CPU? One solution is GetSystemInfo(). Kuphryn

            N Offline
            N Offline
            Nathan Blomquist
            wrote on last edited by
            #5

            With Hyperthreading you have physical processors and logical processors. Example, let's say: I have to physical processors each one is also a logical processor. I then enable hyperthreading on both CPUs. Windows now thinks that I have 4 logical processors, that being each physical processor now represents two logical. I wish to be able to get the number of physical processors and then also the number of logical processors. The reason for this is that if I were to have 4 real physical processors I might then spin out 8 threads. On the other hand, if I have only two physical processors that each are hyperthreaded I would only spin out 6 threads (logical processors aren't as capable as a physical processor). Hope this offers some explanation. -Nathan --------------------------- Hmmm... what's a signature?

            1 Reply Last reply
            0
            • N Nathan Blomquist

              Is there a way to get the number of logical processors in a Windows XP system? If I see that the application is running on Windows XP and that hyperthreading is enabled (how do I do that?) I guess I could just divide by two? Are there any api calls for this? I found something about GetLogicalProcessorInformation, but that didn't seem to be what I need. Thanks, Nathan --------------------------- Hmmm... what's a signature?

              N Offline
              N Offline
              Nathan Blomquist
              wrote on last edited by
              #6

              I found the answer on Intel's site: CPU Counting Utility[^] --------------------------- Hmmm... what's a signature?

              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