File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments