1313namespace mt_kahypar ::dyn {
1414 inline int partition (Context& context) {
1515
16+ context.dynamic .other_timings = OtherTimings ();
17+ auto total_time_start = std::chrono::high_resolution_clock::now ();
18+
1619
1720 context.partition .instance_type = InstanceType::hypergraph;
1821 context.partition .objective = Objective::km1;
1922 context.partition .gain_policy = GainPolicy::km1;
2023
2124 // Read Hypergraph
25+ auto graph_time_parsing_start = std::chrono::high_resolution_clock::now ();
2226 mt_kahypar_hypergraph_t hypergraph_t = io::readInputFile (
2327 context.partition .graph_filename , context.partition .preset_type ,
2428 context.partition .instance_type , context.partition .file_format ,
2529 context.preprocessing .stable_construction_of_incident_edges );
2630 auto & hypergraph_m = utils::cast<ds::MutableHypergraph>(hypergraph_t );
31+ context.dynamic .other_timings .io_time_graph_parsing = std::chrono::high_resolution_clock::now () -
32+ graph_time_parsing_start;
33+
34+ auto setup_time_start = std::chrono::high_resolution_clock::now ();
2735
2836 // Initialize Memory Pool and Algorithm/Policy Registries
2937 register_memory_pool (hypergraph_t , context);
@@ -75,6 +83,8 @@ namespace mt_kahypar::dyn {
7583 LocalFMRound localFM_round = LocalFMRound ();
7684 context.dynamic .local_fm_round = &localFM_round;
7785
86+ context.dynamic .other_timings .setup_time = std::chrono::high_resolution_clock::now () - setup_time_start;
87+
7888 try {
7989
8090 std::cout << " Processing " << num_changes << " changes" << std::endl;
@@ -86,14 +96,17 @@ namespace mt_kahypar::dyn {
8696 size_t log_step_size = num_changes * context.dynamic .logging_step_size_pct ;
8797
8898 auto duration_sum = std::chrono::high_resolution_clock::duration::zero ();
99+ auto change_io_duration_sum = std::chrono::high_resolution_clock::duration::zero ();
89100
90101 for (size_t i = 0 ; i < num_changes; ++i) {
102+ HighResClockTimepoint start_io = std::chrono::high_resolution_clock::now ();
91103 Change change;
92104 if (!context.dynamic .stream_changes ) {
93105 change = changes[i];
94106 } else {
95107 change = parseChange (changes_file);
96108 }
109+ change_io_duration_sum += std::chrono::high_resolution_clock::now () - start_io;
97110 HighResClockTimepoint start = std::chrono::high_resolution_clock::now ();
98111 strategy->partition (change, num_changes);
99112 auto duration = std::chrono::high_resolution_clock::now () - start;
@@ -104,6 +117,9 @@ namespace mt_kahypar::dyn {
104117 log_km1_live (i+1 , num_changes, context, DynamicStrategy::getPartitionedHypergraphCopy (*strategy), duration_sum);
105118 }
106119
120+ context.dynamic .other_timings .strategy_time = duration_sum;
121+ context.dynamic .other_timings .io_time_change_parsing = change_io_duration_sum;
122+
107123 strategy->printAdditionalFinalStats ();
108124
109125 if (context.partition .write_partition_file ) {
@@ -119,6 +135,10 @@ namespace mt_kahypar::dyn {
119135 exit (1 );
120136 }
121137
138+ context.dynamic .other_timings .total_time = std::chrono::high_resolution_clock::now () - total_time_start;
139+ if (context.dynamic .save_other_timings ) {
140+ generateOtherTimingsFile (context);
141+ }
122142 return 0 ;
123143 }
124144}
0 commit comments