crash.types.percpu module
*************************

exception crash.types.percpu.PerCPUError(var: Value | Symbol)

   Bases: "TypeError"

   The passed object does not respond to a percpu pointer.

class crash.types.percpu.PerCPUState

   Bases: "object"

   Per-cpus come in a few forms: - "Array" of objects - "Array" of
   pointers to objects - Pointers to either of those

   If we want to get the typing right, we need to recognize each one
   and figure out what type to pass back.  We do want to dereference
   pointer to a percpu but we don't want to dereference a percpu
   pointer.

   classmethod dump_ranges() -> None

      Dump all percpu ranges to stdout

   get_percpu_var(var: Value | Symbol, cpu: int) -> Value

      Retrieve a per-cpu variable for one or all CPUs

      Parameters:
         * **var** -- The symbol or value to use to resolve the percpu
           location

         * **cpu** -- The cpu for which to return the per-cpu value.

      Returns:
         The value corresponding to the specified CPU. The value is of
         the same type passed via var.

      Return type:
         "gdb.Value"

      Raises:
         * **.InvalidArgumentError** -- var is not "gdb.Symbol" or
           "gdb.Value"

         * **.PerCPUError** -- var does not fall into any percpu range

         * **ValueError** -- cpu is less than "0"

   get_percpu_vars(var: Value | Symbol, nr_cpus: int = None) -> Dict[int, Value]

      Retrieve a per-cpu variable for all CPUs

      Parameters:
         * **var** -- The symbol or value to use to resolve the percpu
           location

         * **nr_cpus** (*optional*) -- The number of CPUs for which to
           return results "None" (or unspecified) will use the highest
           possible CPU count.

      Returns:
         The values corresponding to every CPU in a dictionary indexed
         by CPU number.  The type of the "gdb.Value" used as the
         "dict" value is the same type as the "gdb.Value" or
         "gdb.Symbol" passed as var.

      Return type:
         "dict`(:obj:`int", "gdb.Value")

      Raises:
         * **.InvalidArgumentError** -- var is not "gdb.Symbol" or
           "gdb.Value"

         * **.PerCPUError** -- var does not fall into any percpu range

         * **ValueError** -- nr_cpus is <= "0"

   is_module_percpu_var(addr: int) -> bool

      Returns whether the provided value or symbol falls within any of
      the percpu ranges for modules

      Parameters:
         **addr** -- The address to query

      Returns:
         Whether this address belongs to a module range

      Return type:
         "bool"

   is_percpu_var(var: Value | Symbol) -> bool

      Returns whether the provided value or symbol falls within any of
      the percpu ranges

      Parameters:
         **var** -- The symbol or value to query

      Returns:
         Whether the value belongs to any percpu range

      Return type:
         "bool"

   is_static_percpu_var(addr: int) -> bool

      Returns whether the provided address is within the bounds of the
      percpu static ranges

      Parameters:
         **addr** -- The address to query

      Returns:
         Whether this address belongs to a static range

      Return type:
         "bool"

   classmethod setup_module_ranges(unused: Symbol) -> None

   classmethod setup_nr_cpus(unused: Symbol) -> None

   classmethod setup_per_cpu_size(unused: Symbol) -> None

crash.types.percpu.get_percpu_var(var: Value | Symbol, cpu: int) -> Value

   Retrieve a per-cpu variable for a single CPU

   Parameters:
      * **var** -- The symbol or value to use to resolve the percpu
        location

      * **cpu** -- The cpu for which to return the per-cpu value.

   Returns:
      The value corresponding to the specified CPU. The value is of
      the same type passed via var.

   Return type:
      "gdb.Value"

   Raises:
      * **.InvalidArgumentError** -- var is not "gdb.Symbol"     or
        "gdb.Value"

      * **.PerCPUError** -- var does not fall into any percpu range

      * **ValueError** -- cpu is less than "0"

crash.types.percpu.get_percpu_vars(var: Value | Symbol, nr_cpus: int = None) -> Dict[int, Value]

   Retrieve a per-cpu variable for all CPUs

   Parameters:
      * **var** -- The symbol or value to use to resolve the percpu
        location.

      * **nr_cpus** (*optional*) -- The number of CPUs for which to
        return results. "None" (or unspecified) will use the highest
        possible CPU count.

   Returns:
      The values corresponding to every CPU in a dictionary indexed by
      CPU number.  The type of the "gdb.Value" used as the "dict"
      value is the same type as the "gdb.Value" or "gdb.Symbol" passed
      as var.

   Return type:
      "dict`(:obj:`int", "gdb.Value")

   Raises:
      * **.InvalidArgumentError** -- var is not "gdb.Symbol"     or
        "gdb.Value"

      * **.PerCPUError** -- var does not fall into any percpu range

      * **ValueError** -- nr_cpus is <= "0"

crash.types.percpu.is_percpu_var(var: Value | Symbol) -> bool

   Returns whether the provided value or symbol falls within any of
   the percpu ranges

   Parameters:
      **var** -- The symbol or value to query

   Returns:
      Whether the value belongs to any percpu range

   Return type:
      "bool"

crash.types.percpu.percpu_counter_sum(var: Value | Symbol) -> int

   Returns the sum of a percpu counter

   Parameters:
      **var** -- The percpu counter to sum.  The value must be of type
      "struct percpu_counter".

   Returns:
      the sum of all components of the percpu counter

   Return type:
      "int"
