Skip to content

Commit 07dcfa0

Browse files
committed
[Profiling] Add python scripts to generate per-op profiling from etdumps
ghstack-source-id: 15fa8a1 ghstack-comment-id: 3177134528 Pull Request resolved: #13302
1 parent ed30240 commit 07dcfa0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# Copyright 2024-25 Arm Limited and/or its affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
import argparse
9+
10+
from executorch.devtools import Inspector
11+
12+
13+
def generate_csv(etdump_path, output):
14+
15+
inspector = Inspector(etdump_path)
16+
df = inspector.to_dataframe()
17+
df.to_csv(output)
18+
19+
20+
def main():
21+
parser = argparse.ArgumentParser(
22+
description="Generate profiling CSV from a model's etdump"
23+
)
24+
parser.add_argument(
25+
"--etdump_path",
26+
type=str,
27+
default="./model.etdump",
28+
help="Path to the etdump file",
29+
required=False,
30+
)
31+
32+
parser.add_argument(
33+
"--output",
34+
type=str,
35+
default="./model_profiling.csv",
36+
help="Path to the output CSV file",
37+
required=False,
38+
)
39+
40+
args = parser.parse_args()
41+
print(f"Generating CSV from {args.etdump_path}")
42+
generate_csv(args.etdump_path, args.output)
43+
print(f"Saved CSV to {args.output}")
44+
45+
46+
if __name__ == "__main__":
47+
main()

0 commit comments

Comments
 (0)