Number of CPUs using PHP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shekar

    Number of CPUs using PHP?

    Is there a class/module/function in PHP that will help me identify the
    number of CPUs on a system?
    php_uname() does not provide that information. Though I can execute a
    system command, I do not have a
    consistent method that will work across platforms like Linux, SunOS,
    AIX, HP-UX and Windows*

    Thanks
    Shekar

  • Andy Hassall

    #2
    Re: Number of CPUs using PHP?

    On Thu, 19 Jul 2007 09:08:55 -0700, Shekar <shekariyer@gma il.comwrote:
    >Is there a class/module/function in PHP that will help me identify the
    >number of CPUs on a system?
    >php_uname() does not provide that information. Though I can execute a
    >system command, I do not have a
    >consistent method that will work across platforms like Linux, SunOS,
    >AIX, HP-UX and Windows*
    Not that I'm aware of, and I can't spot anything on PEAR - it's not the sort
    of information you need very often. So you'll probably have to use php_uname
    and then branch out to OS-specific methods (/proc/cpuinfo etc.)

    You may also run into the definition of what is one CPU - multi-core and
    hyperthreading cloud the issue, resulting in widely varying per-CPU licensing
    terms for various commmercial products. Is this what you want the information
    for?

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Shekar

      #3
      Re: Number of CPUs using PHP?

      I want to find the number of CPUs to guage the capacity of the system
      and spawn
      parallel executions to maximize CPU usage. Thanks anyway.

      Comment

      • Tim Roberts

        #4
        Re: Number of CPUs using PHP?

        Shekar <shekariyer@gma il.comwrote:
        >I want to find the number of CPUs to guage the capacity of the system
        >and spawn parallel executions to maximize CPU usage.
        Interesting. How would you expect to do that in PHP?
        --
        Tim Roberts, timr@probo.com
        Providenza & Boekelheide, Inc.

        Comment

        Working...