# mem-phys-addr.py: Resolve physical address samples # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2018, Intel Corporation. from __future__ import division from __future__ import print_function import os import sys import struct import re import bisect import collections sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') #physical address ranges for System RAM system_ram = [] #physical address ranges for Persistent Memory pmem = [] #file object for proc iomem f = None #Count for each type of memory load_mem_type_cnt = collections.Counter() #perf event name event_name = None def parse_iomem(): global f f = open('/proc/iomem', 'r') for i, j in enumerate(f): m = re.split('-|:',j,2) if m[2].strip() == 'System RAM': system_ram.append(int(m[0], 16)) system_ram.append(int(m[1], 16)) if m[2].strip() == 'Persistent Memory': pmem.append(int(m[0], 16)) pmem.append(int(m[1], 16)) def print_memory_type(): print("Event: %s" % (event_name)) print("%-40s %10s %10s\n" % ("Memory type", "count", "percentage"), end='') print("%-40s %10s %10s\n" % ("----------------------------------------", "-----------", "-----------"), end=''); total = sum(load_mem_type_cnt.values()) for mem_type, count in sorted(load_mem_type_cnt.most_common(), \ key = lambda kv: (kv[1], kv[0]), reverse = True): print("%-40s %10d %10.1f%%\n" % (mem_type, count, 100 * count / total), end='') def trace_begin(): parse_iomem() def trace_end(): print_memory_type() f.close() def is_system_ram(phys_addr): #/proc/iomem is sorted position = bisect.bisect(system_ram, phys_addr) if position % 2 == 0: return False return True def is_persistent_mem(phys_addr): position = bisect.bisect(pmem, phys_addr) if position % 2 == 0: return False return True def find_memory_type(phys_addr): if phys_addr == 0: return "N/A" if is_system_ram(phys_addr): return "System RAM" if is_persistent_mem(phys_addr): return "Persistent Memory" #slow path, search all f.seek(0, 0) for j in f: m = re.split('-|:',j,2) if int(m[0], 16) <= phys_addr <= int(m[1], 16): return m[2] return "N/A" def process_event(param_dict): name = param_dict["ev_name"] sample = param_dict["sample"] phys_addr = sample["phys_addr"] global event_name if event_name == None: event_name = name load_mem_type_cnt[find_memory_type(phys_addr)] += 1 >linux-2.6.38.y Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
path: root/drivers/Kconfig
AgeCommit message (Expand)Author
2023-11-10Merge tag 'mips_6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linuxLinus Torvalds
2023-11-01Merge tag 'pmdomain-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/ul...Linus Torvalds
2023-10-19vlynq: remove bus driverWolfram Sang
2023-09-20pmdomain: Prepare to move Kconfig files into the pmdomain subsystemUlf Hansson
2023-09-17dpll: core: Add DPLL framework base functionsVadim Fedorenko
2023-09-08Merge patch series "Add non-coherent DMA support for AX45MP"Palmer Dabbelt
2023-09-01cache: Add L2 cache management for Andes AX45MP RISC-V coreLad Prabhakar
2023-07-22video: Add auxiliary display drivers to Graphics support menuJavier Martinez Canillas
2023-03-29cdx: add the cdx bus driverNipun Gupta
2022-11-22drivers/accel: define kconfig and register a new majorOded Gabbay
2022-06-10vme: move back to stagingArnd Bergmann
2022-06-05Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds
2022-06-05Merge tag 'hte/for-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...Linus Torvalds
2022-05-19scsi: ufs: Split the drivers/scsi/ufs directoryBart Van Assche
2022-05-04drivers: Add hardware timestamp engine (HTE) subsystemDipen Patel
2022-04-20staging: Remove the drivers for the Unisys s-ParFabio M. De Francesco
2022-02-09peci: Add core infrastructureIwona Winiarska
2021-10-07firmware: include drivers/firmware/Kconfig unconditionallyArnd Bergmann
2021-08-14remove the lightnvm subsystemChristoph Hellwig