• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) Qualcomm Innovation Center, Inc.
2# All rights reserved
3#
4# This source code is licensed under the BSD-style license found in the
5# LICENSE file in the root directory of this source tree.
6
7import argparse
8
9from executorch.devtools import Inspector
10
11
12def main(args):
13    # Create an Inspector instance with etdump and the debug buffer.
14    inspector = Inspector(
15        etdump_path=args.etdump_path,
16        etrecord=args.etrecord_path,
17        debug_buffer_path=args.debug_buffer_path,
18    )
19
20    # Accessing intermediate outputs from each event (an event here is essentially an instruction that executed in the runtime).
21    for event_block in inspector.event_blocks:
22        if event_block.name == "Execute":
23            for event in event_block.events:
24                # If user enables profiling and dump intermediate outputs the same time, we need to skip the profiling event
25                if event.perf_data is not None and event.is_delegated_op:
26                    continue
27                print("Event Name: ", event.name)
28                print(event.debug_data)
29
30
31if __name__ == "__main__":
32    parser = argparse.ArgumentParser()
33    parser.add_argument(
34        "--etdump_path",
35        required=True,
36        help="Provide an ETDump file path. File extension should be .etdp",
37    )
38    parser.add_argument(
39        "--etrecord_path",
40        required=False,
41        default=None,
42        help="Provide an optional ETRecord file path. File extension should be .bin",
43    )
44    parser.add_argument(
45        "--debug_buffer_path",
46        required=False,
47        default=None,
48        help="Provide an optional debug buffer file path. File extension should be .bin",
49    )
50    args = parser.parse_args()
51
52    main(args)
53