parameters: ()
return_statement: return _common.scpustats(ctxsw, intrs, soft_intrs, syscalls)
docstring: Return various CPU stats as a named tuple.
docstring_summary: Return various CPU stats as a named tuple.
docstring_tokens: Return various CPU stats as a named tuple .
function: def cpu_stats():
      """Return various CPU stats as a named tuple."""
      if FREEBSD:
          # Note: the C ext is returning some metrics we are not exposing:
          # traps.
          ctxsw, intrs, soft_intrs, syscalls, traps = cext.cpu_stats()
      elif NETBSD:
          # XXX
          # Note about intrs: the C extension returns 0. intrs
          # can be determined via /proc/stat; it has the same value as
          # soft_intrs thought so the kernel is faking it (?).
          #
          # Note about syscalls: the C extension always sets it to 0 (?).
          #
          # Note: the C ext is returning some metrics we are not exposing:
          # traps, faults and forks.
          ctxsw, intrs, soft_intrs, syscalls, traps, faults, forks = \
              cext.cpu_stats()
          with open('/proc/stat', 'rb') as f:
              for line in f:
                  if line.startswith(b'intr'):
                      intrs = int(line.split()[1])
      elif OPENBSD:
          # Note: the C ext is returning some metrics we are not exposing:
          # traps, faults and forks.
          ctxsw, intrs, soft_intrs, syscalls, traps, faults, forks = \
              cext.cpu_stats()
      return _common.scpustats(ctxsw, intrs, soft_intrs, syscalls)
function_tokens: def cpu_stats ( ) : if FREEBSD : # Note: the C ext is returning some metrics we are not exposing: # traps. ctxsw , intrs , soft_intrs , syscalls , traps = cext . cpu_stats ( ) elif NETBSD : # XXX # Note about intrs: the C extension returns 0. intrs # can be determined via /proc/stat; it has the same value as # soft_intrs thought so the kernel is faking it (?). # # Note about syscalls: the C extension always sets it to 0 (?). # # Note: the C ext is returning some metrics we are not exposing: # traps, faults and forks. ctxsw , intrs , soft_intrs , syscalls , traps , faults , forks = cext . cpu_stats ( ) with open ( '/proc/stat' , 'rb' ) as f : for line in f : if line . startswith ( b'intr' ) : intrs = int ( line . split ( ) [ 1 ] ) elif OPENBSD : # Note: the C ext is returning some metrics we are not exposing: # traps, faults and forks. ctxsw , intrs , soft_intrs , syscalls , traps , faults , forks = cext . cpu_stats ( ) return _common . scpustats ( ctxsw , intrs , soft_intrs , syscalls )