@@ -17,26 +17,58 @@ enum Command {
1717 path : PathBuf ,
1818 #[ arg( long) ]
1919 json : bool ,
20+ #[ arg( long) ]
21+ memory : bool ,
22+ } ,
23+ RayforceVersion ,
24+ Memory {
25+ path : PathBuf ,
2026 } ,
2127}
2228
2329fn main ( ) -> Result < ( ) > {
2430 let args = Args :: parse ( ) ;
2531
2632 match args. command {
27- Command :: Observe { path, json } => {
33+ Command :: Observe { path, json, memory } => {
2834 let report = scan_path ( path) ?;
2935 if json {
3036 println ! ( "{}" , serde_json:: to_string_pretty( & report) ?) ;
37+ } else if memory {
38+ let memory = raysense_memory:: RayMemory :: from_report ( & report) ?;
39+ print_memory_summary ( & memory. summary ( ) ) ;
3140 } else {
3241 print_summary ( & report) ;
3342 }
3443 }
44+ Command :: RayforceVersion => {
45+ println ! ( "{}" , rayforce_sys:: version_string( ) ) ;
46+ }
47+ Command :: Memory { path } => {
48+ let report = scan_path ( path) ?;
49+ let memory = raysense_memory:: RayMemory :: from_report ( & report) ?;
50+ print_memory_summary ( & memory. summary ( ) ) ;
51+ }
3552 }
3653
3754 Ok ( ( ) )
3855}
3956
57+ fn print_memory_summary ( summary : & raysense_memory:: MemorySummary ) {
58+ println ! (
59+ "files rows={} cols={}" ,
60+ summary. files. rows, summary. files. columns
61+ ) ;
62+ println ! (
63+ "functions rows={} cols={}" ,
64+ summary. functions. rows, summary. functions. columns
65+ ) ;
66+ println ! (
67+ "imports rows={} cols={}" ,
68+ summary. imports. rows, summary. imports. columns
69+ ) ;
70+ }
71+
4072fn print_summary ( report : & raysense_core:: ScanReport ) {
4173 println ! ( "snapshot {}" , report. snapshot. snapshot_id) ;
4274 println ! ( "root {}" , report. snapshot. root. display( ) ) ;
0 commit comments