66
77use function Flow \ETL \DSL \{analyze , refs , to_output };
88use Flow \ETL \DataFrame \GroupedDataFrame ;
9- use Flow \ETL \Dataset \{Report , Statistics };
9+ use Flow \ETL \Dataset \{Memory \ Consumption , Report , Statistics };
1010use Flow \ETL \Dataset \Statistics \{Columns , ExecutionTime , HighResolutionTime };
1111use Flow \ETL \Exception \{InvalidArgumentException , RuntimeException };
1212use Flow \ETL \Extractor \FileExtractor ;
@@ -757,6 +757,7 @@ public function run(?callable $callback = null, bool|Analyze $analyze = false) :
757757 $ analyze = $ analyze === true ? analyze () : $ analyze ;
758758
759759 if ($ analyze ) {
760+ $ memory = new Consumption ();
760761 $ startedAt = $ this ->context ->config ->clock ()->now ();
761762 $ startTime = HighResolutionTime::now ();
762763 $ columnStatistics = $ analyze ->collectColumnStatistics () ? new Columns () : null ;
@@ -770,6 +771,7 @@ public function run(?callable $callback = null, bool|Analyze $analyze = false) :
770771
771772 if ($ analyze ) {
772773 $ totalRows += $ rows ->count ();
774+ $ memory ->capture ();
773775
774776 if ($ schema !== null ) {
775777 $ schema = $ schema ->merge ($ rows ->schema ());
@@ -794,6 +796,7 @@ public function run(?callable $callback = null, bool|Analyze $analyze = false) :
794796 new Statistics (
795797 $ totalRows ,
796798 new ExecutionTime ($ startedAt , $ endedAt , $ startTime ->diff ($ endTime )),
799+ $ memory ,
797800 $ columnStatistics
798801 )
799802 );
0 commit comments