@@ -1212,6 +1212,9 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
12121212 . collect :: < Vec < _ > > ( ) ;
12131213 if !task_cache_stats. is_empty ( ) {
12141214 use turbo_tasks:: util:: FormatBytes ;
1215+
1216+ use crate :: utils:: markdown_table:: print_markdown_table;
1217+
12151218 task_cache_stats. sort_unstable_by ( |( key_a, stats_a) , ( key_b, stats_b) | {
12161219 ( stats_b. data_compressed + stats_b. meta_compressed , key_b)
12171220 . cmp ( & ( stats_a. data_compressed + stats_a. meta_compressed , key_a) )
@@ -1232,42 +1235,79 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
12321235 )
12331236 ) ;
12341237
1235- for ( task_desc, stats) in task_cache_stats {
1236- println ! (
1237- " {} ({}) {task_desc} = {} ({}) meta {} x {} ({}), {} ({}) data {} x \
1238- {} ({}), upper: {}, coll: {}, agg_coll: {}, children: {}, followers: \
1239- {}, coll_deps: {}, agg_dirty: {}",
1240- FormatBytes ( stats. data_compressed + stats. meta_compressed) ,
1241- FormatBytes ( stats. data + stats. meta) ,
1242- FormatBytes ( stats. meta_compressed) ,
1243- FormatBytes ( stats. meta) ,
1244- stats. meta_count,
1245- FormatBytes (
1246- stats
1247- . meta_compressed
1248- . checked_div( stats. meta_count)
1249- . unwrap_or( 0 )
1250- ) ,
1251- FormatBytes ( stats. meta. checked_div( stats. meta_count) . unwrap_or( 0 ) ) ,
1252- FormatBytes ( stats. data_compressed) ,
1253- FormatBytes ( stats. data) ,
1254- stats. data_count,
1255- FormatBytes (
1256- stats
1257- . data_compressed
1258- . checked_div( stats. data_count)
1259- . unwrap_or( 0 )
1260- ) ,
1261- FormatBytes ( stats. data. checked_div( stats. data_count) . unwrap_or( 0 ) ) ,
1262- stats. upper_count,
1263- stats. collectibles_count,
1264- stats. aggregated_collectibles_count,
1265- stats. children_count,
1266- stats. followers_count,
1267- stats. collectibles_dependents_count,
1268- stats. aggregated_dirty_containers_count,
1269- ) ;
1270- }
1238+ print_markdown_table (
1239+ [
1240+ "Task" ,
1241+ "Total Size" ,
1242+ "Data Size" ,
1243+ "Data Count x Avg" ,
1244+ "Meta Size" ,
1245+ "Meta Count x Avg" ,
1246+ "Uppers" ,
1247+ "Coll" ,
1248+ "Agg Coll" ,
1249+ "Children" ,
1250+ "Followers" ,
1251+ "Coll Deps" ,
1252+ "Agg Dirty" ,
1253+ "Output Size" ,
1254+ ] ,
1255+ task_cache_stats. iter ( ) ,
1256+ |( task_desc, stats) | {
1257+ [
1258+ task_desc. to_string ( ) ,
1259+ format ! (
1260+ "{} ({})" ,
1261+ FormatBytes ( stats. data_compressed + stats. meta_compressed) ,
1262+ FormatBytes ( stats. data + stats. meta)
1263+ ) ,
1264+ format ! (
1265+ "{} ({})" ,
1266+ FormatBytes ( stats. data_compressed) ,
1267+ FormatBytes ( stats. data)
1268+ ) ,
1269+ format ! (
1270+ "{} x {} ({})" ,
1271+ stats. data_count,
1272+ FormatBytes (
1273+ stats
1274+ . data_compressed
1275+ . checked_div( stats. data_count)
1276+ . unwrap_or( 0 )
1277+ ) ,
1278+ FormatBytes (
1279+ stats. data. checked_div( stats. data_count) . unwrap_or( 0 )
1280+ ) ,
1281+ ) ,
1282+ format ! (
1283+ "{} ({})" ,
1284+ FormatBytes ( stats. meta_compressed) ,
1285+ FormatBytes ( stats. meta)
1286+ ) ,
1287+ format ! (
1288+ "{} x {} ({})" ,
1289+ stats. meta_count,
1290+ FormatBytes (
1291+ stats
1292+ . meta_compressed
1293+ . checked_div( stats. meta_count)
1294+ . unwrap_or( 0 )
1295+ ) ,
1296+ FormatBytes (
1297+ stats. meta. checked_div( stats. meta_count) . unwrap_or( 0 )
1298+ ) ,
1299+ ) ,
1300+ stats. upper_count . to_string ( ) ,
1301+ stats. collectibles_count . to_string ( ) ,
1302+ stats. aggregated_collectibles_count . to_string ( ) ,
1303+ stats. children_count . to_string ( ) ,
1304+ stats. followers_count . to_string ( ) ,
1305+ stats. collectibles_dependents_count . to_string ( ) ,
1306+ stats. aggregated_dirty_containers_count . to_string ( ) ,
1307+ FormatBytes ( stats. output_size ) . to_string ( ) ,
1308+ ]
1309+ } ,
1310+ ) ;
12711311 }
12721312 }
12731313 }
0 commit comments