@@ -27,6 +27,8 @@ def set_target(pid, init_regions=[]):
if not os.path.exists(debugfs_init_regions):
return 0
+ if pid == 'paddr':
+ pid = -1
string = ' '.join(['%s %d %d' % (pid, r[0], r[1]) for r in init_regions])
return subprocess.call('echo "%s" > %s' % (string, debugfs_init_regions),
shell=True, executable='/bin/bash')
@@ -307,7 +307,7 @@ def plot_heatmap(data_file, output_file):
set xrange [0:];
set yrange [0:];
set xlabel 'Time (ns)';
- set ylabel 'Virtual Address (bytes)';
+ set ylabel 'Address (bytes)';
plot '%s' using 1:2:3 with image;""" % (terminal, output_file, data_file)
subprocess.call(['gnuplot', '-e', gnuplot_cmd])
os.remove(data_file)
@@ -73,6 +73,29 @@ def set_argparser(parser):
parser.add_argument('-o', '--out', metavar='<file path>', type=str,
default='damon.data', help='output file path')
+def default_paddr_region():
+ "Largest System RAM region becomes the default"
+ ret = []
+ with open('/proc/iomem', 'r') as f:
+ # example of the line: '100000000-42b201fff : System RAM'
+ for line in f:
+ fields = line.split(':')
+ if len(fields) != 2:
+ continue
+ name = fields[1].strip()
+ if name != 'System RAM':
+ continue
+ addrs = fields[0].split('-')
+ if len(addrs) != 2:
+ continue
+ start = int(addrs[0], 16)
+ end = int(addrs[1], 16)
+
+ sz_region = end - start
+ if not ret or sz_region > (ret[1] - ret[0]):
+ ret = [start, end]
+ return ret
+
def main(args=None):
global orig_attrs
if not args:
@@ -93,7 +116,11 @@ def main(args=None):
target = args.target
target_fields = target.split()
- if not subprocess.call('which %s > /dev/null' % target_fields[0],
+ if target == 'paddr': # physical memory address space
+ if not init_regions:
+ init_regions = [default_paddr_region()]
+ do_record(target, False, init_regions, new_attrs, orig_attrs)
+ elif not subprocess.call('which %s > /dev/null' % target_fields[0],
shell=True, executable='/bin/bash'):
do_record(target, True, init_regions, new_attrs, orig_attrs)
else: