# 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 tion> Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
path: root/Documentation/userspace-api/ioctl
AgeCommit message (Expand)Author
2022-06-27scsi: dpt_i2o: Remove obsolete driverArnd Bergmann
2022-05-15cdrom: mark CDROMGETSPINDOWN/CDROMSETSPINDOWN obsoletePaul Gortmaker
2022-03-25Merge tag 'platform-drivers-x86-v5.18-1' of git://git.kernel.org/pub/scm/linu...Linus Torvalds
2022-03-21Merge tag 'docs-5.18' of git://git.lwn.net/linuxLinus Torvalds
2022-03-02platform/x86: Add AMD system management interfaceSuma Hegde
2022-02-15Documentation: Fix links for udftools project and pktcdvd toolPali Rohár
2022-02-03xen: update missing ioctl magic numers documentationRandy Dunlap
2021-12-27ACPI: Introduce Platform Firmware Runtime Update device driverChen Yu
2021-11-04Merge tag 'char-misc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g...Linus Torvalds
2021-11-01Merge tag 'for-5.16/cdrom-2021-10-29' of git://git.kernel.dk/linux-blockLinus Torvalds
2021-10-27ptp: Document the PTP_CLK_MAGIC ioctl numberRandy Dunlap
2021-10-17docs: counter: Document character device interfaceWilliam Breathitt Gray
2021-10-10cdrom: docs: reformat table in Documentation/userspace-api/ioctl/cdrom.rstPhillip Potter
2021-09-14drivers/cdrom: improved ioctl for media change detectionLukas Prediger
2021-09-11Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds
2021-09-06vduse: Introduce VDUSE - vDPA Device in UserspaceXie Yongji
2021-08-14remove the lightnvm subsystemChristoph Hellwig
2021-06-30Merge tag 'platform-drivers-x86-v5.14-1' of git://git.kernel.org/pub/scm/linu...Linus Torvalds
2021-06-16platform/surface: aggregator_cdev: Add support for forwarding events to user-...Maximilian Luz
2021-06-16ide: remove the legacy ide driverChristoph Hellwig
2021-04-26Merge tag 'docs-5.13' of git://git.lwn.net/linuxLinus Torvalds
2021-04-26Merge tag 'tty-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gre...Linus Torvalds
2021-04-26Merge tag 'staging-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...Linus Torvalds
2021-03-17platform/surface: Add DTX driverMaximilian Luz
2021-03-11docs: ioctl-number.rst: reserve IIO subsystem ioctl() spaceAlexandru Ardelean
2021-03-10tty: cyclades, remove this orphanJiri Slaby
2021-03-06Documentation: ioctl: add entry for nsfs.hRandy Dunlap
2021-02-24Merge tag 'char-misc-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g...Linus Torvalds
2021-02-24Merge tag 'cxl-for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/nvd...Linus Torvalds
2021-02-22Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds
2021-02-16cxl/mem: Add basic IOCTL interfaceBen Widawsky
2021-02-09virt: acrn: Introduce VM management interfacesShuo Liu
2021-01-27bus: fsl-mc: add fsl-mc userspace supportIoana Ciornei
2021-01-22scsi: Drop gdth driverHannes Reinecke
2021-01-07platform/surface: Add Surface Aggregator user-space interfaceMaximilian Luz
2020-11-18x86/sgx: Add SGX_IOC_ENCLAVE_CREATEJarkko Sakkinen
2020-10-15Merge tag 'drm-next-2020-10-15' of git://anongit.freedesktop.org/drm/drmLinus Torvalds
2020-10-15Merge tag 'char-misc-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g...Linus Torvalds
2020-09-25Documentation/hdio: fix up obscure bd_contains referencesChristoph Hellwig
2020-09-22nitro_enclaves: Add ioctl interface definitionAndra Paraschiv
2020-09-08fbdev: remove mbx framebuffer driverMike Rapoport
2020-08-04remoteproc: Add remoteproc character device interfaceSiddharth Gupta
2020-06-13Merge tag 'notifications-20200601' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds
2020-06-05Merge tag 'powerpc-5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/po...Linus Torvalds
2020-05-19pipe: Add general notification queue supportDavid Howells
2020-04-20docs: ioctl-number.rst: add habanalabs driver IOCTLOded Gabbay
2020-04-20powerpc/vas: Define VAS_TX_WIN_OPEN ioctl APIHaren Myneni
2020-02-13docs: userspace: ioctl-number: remove mc146818rtc conflictAlexandre Belloni