Skip to content

Commit ee2ce6f

Browse files
captain5050acmel
authored andcommitted
perf jevents: Provide path to JSON file on error
If a JSONDecoderError or similar is raised then it is useful to know the path. Print this and then raise the exception agan. Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Will Deacon <[email protected]> Cc: Xing Zhengjun <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent f793ae1 commit ee2ce6f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/perf/pmu-events/jevents.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ def str_if_present(self, attr: str) -> str:
225225

226226
def read_json_events(path: str) -> Sequence[JsonEvent]:
227227
"""Read json events from the specified file."""
228-
return json.load(open(path), object_hook=lambda d: JsonEvent(d))
228+
229+
try:
230+
return json.load(open(path), object_hook=lambda d: JsonEvent(d))
231+
except BaseException as err:
232+
print(f"Exception processing {path}")
233+
raise
229234

230235

231236
def preprocess_arch_std_files(archpath: str) -> None:

0 commit comments

Comments
 (0)