# 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 ption> Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
path: root/fs/efs
AgeCommit message (Expand)Author
2009-06-17get rid of BKL in fs/efsAl Viro
2009-04-02fs/efs: return f_fsid for statfs(2)Coly Li
2009-01-22fs/Kconfig: move efs outAlexey Dobriyan
2008-10-23[PATCH] switch all filesystems over to d_obtain_aliasChristoph Hellwig
2008-09-02EFS: Don't set f_fsid in statfs().David Woodhouse
2008-08-25[PATCH] fix efs_lookup()Al Viro
2008-07-26SL*B: drop kmem cache argument from constructorAlexey Dobriyan
2008-04-02efs: update error msg to not refer to deleted read_inode()Robert P. J. Day
2008-02-23efs: move headers out of include/linux/Christoph Hellwig
2008-02-07iget: stop EFS from using iget() and read_inode()David Howells
2007-10-22exportfs: make struct export_operations constChristoph Hellwig
2007-10-22efs: new export opsChristoph Hellwig
2007-10-17Slab API: remove useless ctor parameter and reorder parametersChristoph Lameter
2007-07-20mm: Remove slab destructors from kmem_cache_create().Paul Mundt
2007-07-17knfsd: exportfs: remove iget abuseChristoph Hellwig
2007-07-17knfsd: exportfs: add exportfs.h headerChristoph Hellwig
2007-05-17Remove SLAB_CTOR_CONSTRUCTORChristoph Lameter
2007-05-07slab allocators: Remove SLAB_DEBUG_INITIAL flagChristoph Lameter
2007-02-12[PATCH] Mark struct super_operations constJosef 'Jeff' Sipek
2007-02-12[PATCH] mark struct inode_operations const 1Arjan van de Ven