diff options
| author | Takashi Iwai <tiwai@suse.de> | 2019-04-11 08:36:30 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2019-04-11 08:36:30 -0400 |
| commit | 9b0dcd0e5a27958b57e3e390f63c098d63a055da (patch) | |
| tree | de778d683f121d3062df316994e9c4cf195eb12c /tools/perf/scripts/python/mem-phys-addr.py | |
| parent | d7a181da2dfa3190487c446042ba01e07d851c74 (diff) | |
| parent | ac71317e6be01812cc0c54d8be6d3c1139c8380b (diff) | |
Merge tag 'asoc-fix-v5.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.1
A few core fixes along with the driver specific ones, mainly fixing
small issues that only affect x86 platforms for various reasons (their
unusual machine enumeration mechanisms mainly, plus a fix for error
handling in topology).
There's some of the driver fixes that look larger than they are, like
the hdmi-codec changes which resulted in an indentation change, and most
of the other large changes are for new drivers like the STM32 changes.
Diffstat (limited to 'tools/perf/scripts/python/mem-phys-addr.py')
| -rw-r--r-- | tools/perf/scripts/python/mem-phys-addr.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tools/perf/scripts/python/mem-phys-addr.py b/tools/perf/scripts/python/mem-phys-addr.py index ebee2c5ae496..1f332e72b9b0 100644 --- a/tools/perf/scripts/python/mem-phys-addr.py +++ b/tools/perf/scripts/python/mem-phys-addr.py | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | # Copyright (c) 2018, Intel Corporation. | 4 | # Copyright (c) 2018, Intel Corporation. |
| 5 | 5 | ||
| 6 | from __future__ import division | 6 | from __future__ import division |
| 7 | from __future__ import print_function | ||
| 8 | |||
| 7 | import os | 9 | import os |
| 8 | import sys | 10 | import sys |
| 9 | import struct | 11 | import struct |
| @@ -31,21 +33,24 @@ def parse_iomem(): | |||
| 31 | for i, j in enumerate(f): | 33 | for i, j in enumerate(f): |
| 32 | m = re.split('-|:',j,2) | 34 | m = re.split('-|:',j,2) |
| 33 | if m[2].strip() == 'System RAM': | 35 | if m[2].strip() == 'System RAM': |
| 34 | system_ram.append(long(m[0], 16)) | 36 | system_ram.append(int(m[0], 16)) |
| 35 | system_ram.append(long(m[1], 16)) | 37 | system_ram.append(int(m[1], 16)) |
| 36 | if m[2].strip() == 'Persistent Memory': | 38 | if m[2].strip() == 'Persistent Memory': |
| 37 | pmem.append(long(m[0], 16)) | 39 | pmem.append(int(m[0], 16)) |
| 38 | pmem.append(long(m[1], 16)) | 40 | pmem.append(int(m[1], 16)) |
| 39 | 41 | ||
| 40 | def print_memory_type(): | 42 | def print_memory_type(): |
| 41 | print "Event: %s" % (event_name) | 43 | print("Event: %s" % (event_name)) |
| 42 | print "%-40s %10s %10s\n" % ("Memory type", "count", "percentage"), | 44 | print("%-40s %10s %10s\n" % ("Memory type", "count", "percentage"), end='') |
| 43 | print "%-40s %10s %10s\n" % ("----------------------------------------", \ | 45 | print("%-40s %10s %10s\n" % ("----------------------------------------", |
| 44 | "-----------", "-----------"), | 46 | "-----------", "-----------"), |
| 47 | end=''); | ||
| 45 | total = sum(load_mem_type_cnt.values()) | 48 | total = sum(load_mem_type_cnt.values()) |
| 46 | for mem_type, count in sorted(load_mem_type_cnt.most_common(), \ | 49 | for mem_type, count in sorted(load_mem_type_cnt.most_common(), \ |
| 47 | key = lambda(k, v): (v, k), reverse = True): | 50 | key = lambda kv: (kv[1], kv[0]), reverse = True): |
| 48 | print "%-40s %10d %10.1f%%\n" % (mem_type, count, 100 * count / total), | 51 | print("%-40s %10d %10.1f%%\n" % |
| 52 | (mem_type, count, 100 * count / total), | ||
| 53 | end='') | ||
| 49 | 54 | ||
| 50 | def trace_begin(): | 55 | def trace_begin(): |
| 51 | parse_iomem() | 56 | parse_iomem() |
| @@ -80,7 +85,7 @@ def find_memory_type(phys_addr): | |||
| 80 | f.seek(0, 0) | 85 | f.seek(0, 0) |
| 81 | for j in f: | 86 | for j in f: |
| 82 | m = re.split('-|:',j,2) | 87 | m = re.split('-|:',j,2) |
| 83 | if long(m[0], 16) <= phys_addr <= long(m[1], 16): | 88 | if int(m[0], 16) <= phys_addr <= int(m[1], 16): |
| 84 | return m[2] | 89 | return m[2] |
| 85 | return "N/A" | 90 | return "N/A" |
| 86 | 91 | ||
