This is xnu-8019. See this file in:
from memory import IterateZPerCPU
from xnu import *

@header("Counter Value\n-------------")
def GetSimpleCounter(counter):
    """ Prints out the value of a percpu counter
        params: counter: value - value object representing counter
        returns: str - THe value of the counter as a string.
    val = 0
    for v in IterateZPerCPU(counter, "uint64_t *"):
        val += dereference(v)
    return str(val)

def ShowSimpleCounter(cmd_args=None):
    """ Show the value of a percpu counter.
        Usage: showcounter <address of counter>
    if not cmd_args:
        raise ArgumentError("Please specify the address of the counter you want to read.")
    print GetSimpleCounter(kern.GetValueFromAddress(cmd_args[0], "scalable_counter_t"))