Skip to content
  • Lorenz Huedepohl's avatar
    Measure RAM access with Linux perf API · 49797bea
    Lorenz Huedepohl authored
    There is currently no reliable way to measure RAM accesses with PAPI,
    the previous way by counting load and store instructions is not very
    useful, as it is unknown how many bytes are transferred in each
    instruction.
    
    On certain CPUs there is a reliable way to measure this via an "uncore"
    performance counter, one can check if your CPU (and/or Linux kernel
    version) support this by checking if the files
    
    	/sys/devices/uncore_imc/events/data_reads
    	/sys/devices/uncore_imc/events/data_writes
    
    exist.
    
    To access these counter from an unprivileged program one has to set the
    "paranoia" level of the perf subsystem to at most 0, adjustable via the
    file
    
    	/proc/sys/kernel/perf_event_paranoid
    
    Along with this change there is a small API/ABI breakage as some keyword
    arguments related to the memory measurement have been renamed/split-up.
    49797bea