diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2020-08-12 20:17:18 +0300 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2020-08-12 21:42:08 +0300 |
| commit | 534b1f9071d95325044c21d47d9f63a45cdf425e (patch) | |
| tree | 5c2aa3cd65bfb6b9e73d9ad22c021d800380f0f6 /tools/perf/scripts/python/flamegraph.py | |
| parent | 82dd18096c718962379e61cd8a7a0dc219db174f (diff) | |
| parent | 62975d27d647a40c58d3b96c29b911fc4f33c310 (diff) | |
| download | linux-534b1f9071d95325044c21d47d9f63a45cdf425e.tar.xz | |
Merge drm/drm-next into drm-misc-next
Backmerging drm-next into drm-misc-next for nouveau and panel updates.
Resolves a conflict between ttm and nouveau, where struct ttm_mem_res got
renamed to struct ttm_resource.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
| -rwxr-xr-x | tools/perf/scripts/python/flamegraph.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/scripts/python/flamegraph.py b/tools/perf/scripts/python/flamegraph.py index 61f3be9add6b..65780013f745 100755 --- a/tools/perf/scripts/python/flamegraph.py +++ b/tools/perf/scripts/python/flamegraph.py @@ -17,6 +17,7 @@ from __future__ import print_function import sys import os +import io import argparse import json @@ -81,7 +82,7 @@ class FlameGraphCLI: if self.args.format == "html": try: - with open(self.args.template) as f: + with io.open(self.args.template, encoding="utf-8") as f: output_str = f.read().replace("/** @flamegraph_json **/", json_str) except IOError as e: @@ -93,11 +94,12 @@ class FlameGraphCLI: output_fn = self.args.output or "stacks.json" if output_fn == "-": - sys.stdout.write(output_str) + with io.open(sys.stdout.fileno(), "w", encoding="utf-8", closefd=False) as out: + out.write(output_str) else: print("dumping data to {}".format(output_fn)) try: - with open(output_fn, "w") as out: + with io.open(output_fn, "w", encoding="utf-8") as out: out.write(output_str) except IOError as e: print("Error writing output file: {}".format(e), file=sys.stderr) |
