@@ -77,36 +77,76 @@ private static void DebugScript(string[] args)
7777 }
7878 }
7979
80+ private class PInfo
81+ {
82+ public DateTime DateTimeStart { get ; set ; }
83+ public DateTime DateTimeLoad { get ; set ; }
84+
85+ public double SizeAppInRam { get ; set ; }
86+ public double SizeCorpusInRam { get ; set ; }
87+ public double SizeMaxRamUse { get ; set ; }
88+
89+ public void Print ( )
90+ {
91+ var end = DateTime . Now ;
92+ System . Console . WriteLine ( $ "RAM (app): { SizeAppInRam / 1024 / 1024 } ") ;
93+ System . Console . WriteLine ( $ "Load corpus: { ( DateTimeLoad - DateTimeStart ) . Milliseconds } ms") ;
94+ System . Console . WriteLine ( $ "RAM (corpus): { SizeCorpusInRam / 1024 / 1024 } MB") ;
95+ System . Console . WriteLine ( $ "Execute action: { ( end - DateTimeLoad ) . Milliseconds } ms") ;
96+ System . Console . WriteLine ( $ "RAM (all): { SizeMaxRamUse / 1024 / 1024 } MB") ;
97+ }
98+ }
99+
100+ private static PInfo _pInfo = null ;
101+
80102 private static void Execute ( string [ ] args )
81103 {
82- if ( args . Length > 0 && args [ 0 ] == "/WAIT" )
104+ if ( args == null || args . Length == 0 )
83105 {
84- System . Console . WriteLine ( "...PRESS ENTER TO CONTINUE..." ) ;
85- System . Console . ReadLine ( ) ;
106+ PrintHelp ( true ) ;
107+ return ;
108+ }
86109
110+ // --> Start of dev-relevant arguments
111+ if ( args . Length > 0 && args [ 0 ] == "/PINFO" )
112+ {
87113 var tmp = args . ToList ( ) ;
88114 tmp . RemoveAt ( 0 ) ;
89115
90116 args = tmp . ToArray ( ) ;
117+ _pInfo = new PInfo
118+ {
119+ DateTimeStart = DateTime . Now ,
120+ SizeAppInRam = GC . GetTotalMemory ( false )
121+ } ;
91122 }
92123
93- if ( args == null || args . Length == 0 )
124+ if ( args . Length > 0 && args [ 0 ] == "/WAIT" )
94125 {
95- PrintHelp ( true ) ;
96- return ;
126+ System . Console . WriteLine ( "...PRESS ENTER TO CONTINUE..." ) ;
127+ System . Console . ReadLine ( ) ;
128+
129+ var tmp = args . ToList ( ) ;
130+ tmp . RemoveAt ( 0 ) ;
131+
132+ args = tmp . ToArray ( ) ;
97133 }
98134
99135 if ( args . Length == 1 && args [ 0 ] == "--github" )
100136 {
101137 PrintDocs ( ) ;
102138 return ;
103139 }
140+ // <-- End of dev-relevant arguments
104141
105- if ( args [ 0 ] . StartsWith ( " WAIT:" ) )
142+ if ( args . Length > 0 && args [ 0 ] == "/ WAIT" )
106143 {
107- Wait ( args [ 0 ] ) ;
144+ System . Console . WriteLine ( "...PRESS ENTER TO CONTINUE..." ) ;
145+ System . Console . ReadLine ( ) ;
146+
108147 var tmp = args . ToList ( ) ;
109148 tmp . RemoveAt ( 0 ) ;
149+
110150 args = tmp . ToArray ( ) ;
111151 }
112152
@@ -226,8 +266,8 @@ private static void ExecuteWebservice(string[] args)
226266 file = arg ;
227267 }
228268
229- #if Featherweight
230- #else
269+ #if Featherweight
270+ #else
231271 if ( file . Contains ( "#" ) )
232272 {
233273 var ws = new WebService ( _writer , ip , port , file , timeout ) ;
@@ -238,7 +278,7 @@ private static void ExecuteWebservice(string[] args)
238278 var ws = new WebService ( _writer , ip , port , file , timeout ) ;
239279 ws . Run ( ) ;
240280 }
241- #endif
281+ #endif
242282 }
243283
244284 private static void ExecuteDirect ( string [ ] args )
@@ -253,10 +293,22 @@ private static void ExecuteDirect(string[] args)
253293 if ( selection == null )
254294 return ;
255295
296+ if ( _pInfo != null )
297+ {
298+ _pInfo . DateTimeLoad = DateTime . Now ;
299+ _pInfo . SizeCorpusInRam = GC . GetTotalMemory ( false ) ;
300+ }
301+
256302 var temp = args . ToList ( ) ;
257303 temp . RemoveAt ( 0 ) ; // CorpusFile (no longer needed)
258304 temp . RemoveAt ( 0 ) ; // Action (no longer needed)
259305 action . Execute ( selection , temp . ToArray ( ) , _writer ) ;
306+
307+ if ( _pInfo != null )
308+ {
309+ _pInfo . SizeMaxRamUse = GC . GetTotalMemory ( false ) ;
310+ _pInfo . Print ( ) ;
311+ }
260312 }
261313
262314 private static void ExecuteShell ( )
0 commit comments