@@ -60,7 +60,8 @@ int main(int argc, char **argv) {
6060 size_t empty = 0 ;
6161 std::chrono::duration<double > ingest_time (0 );
6262 std::chrono::duration<double > query_time (0 );
63- std::chrono::duration<double > filter_time (0 );
63+ std::chrono::duration<double > sample_time (0 );
64+ std::chrono::duration<double > delete_time (0 );
6465
6566 for (size_t trial = 0 ; trial < trials; trial++) {
6667 BinaryFileStream stream (stream_file);
@@ -79,65 +80,37 @@ int main(int argc, char **argv) {
7980 std::cout << " Beginning stream ingestion ... " ; fflush (stdout);
8081 auto start = std::chrono::steady_clock::now ();
8182 driver.process_stream_until (END_OF_STREAM);
83+ driver.prep_query (KSPANNINGFORESTS);
8284 std::cout << " Stream processed!" << std::endl;
8385 ingest_time += std::chrono::steady_clock::now () - start;
84- size_t max_rounds_used = 0 ;
86+ std::cout << " Ingestion throughput: " << num_updates / std::chrono::duration< double >( std::chrono::steady_clock::now () - start). count () << std::endl ;
8587
8688 // figure out how many rounds are required to extract log V spanning forests
87- for (size_t s = 0 ; s < vertex_power; s++) {
88- auto start = std::chrono::steady_clock::now ();
89- try {
90- driver.prep_query (KSPANNINGFORESTS);
91- SpanningForest forest = cc_alg.calc_spanning_forest ();
92- std::cout << " sf: " << s + 1 << " , rounds: " << cc_alg.last_query_rounds
93- << " /" << cc_alg.max_rounds () << " \r " ;
94- fflush (stdout);
95- max_rounds_used = std::max (max_rounds_used, cc_alg.last_query_rounds );
96-
97- query_time += std::chrono::steady_clock::now () - start;
98-
99- if (forest.get_edges ().size () == 0 ) {
100- std::cout << std::endl << " Exiting because of empty Spanning Forest " << s << std::endl;
101- empty += 1 ;
102- break ;
103- }
104- start = std::chrono::steady_clock::now ();
105- const auto &sf_edges = forest.get_edges ();
106-
107- // filter out all the found edges from the sketches
108- // This is technically illegal behavior. Which is like the point of this test :)
109- for (auto edge : sf_edges) {
110- cc_alg.update ({edge, DELETE});
111- }
112- filter_time += std::chrono::steady_clock::now () - start;
113- } catch (OutOfSamplesException &err) {
114- std::cout << std::endl << " Got OutOfSamplesException on spanning forest " << s + 1 << std::endl;
115- errors += 1 ;
116- break ;
117- } catch (...) {
118- std::cout << std::endl << " Got unknown exception on spanning forest " << s + 1 << std::endl;
119- errors += 1 ;
120- break ;
121- }
122- }
89+ start = std::chrono::steady_clock::now ();
90+ cc_alg.calc_disjoint_spanning_forests (vertex_power);
91+ query_time += std::chrono::steady_clock::now () - start;
12392
12493 // add number of rounds to get log V spanning forests to vector
125- rounds_required[max_rounds_used] += 1 ;
94+ rounds_required[cc_alg.last_query_rounds ] += 1 ;
95+
96+ sample_time += cc_alg.query_time ;
97+ delete_time += cc_alg.delete_time ;
12698 }
12799
128100 std::cout << std::endl;
129101 std::cout << " ERRORS = " << errors << std::endl;
130102 std::cout << " EMPTY = " << empty << std::endl;
131103
132- for (size_t i = 0 ; i < rounds_required.size (); i++) {
133- std::cout << i << " , " << rounds_required[i] << std::endl;
134- }
104+ // for (size_t i = 0; i < rounds_required.size(); i++) {
105+ // std::cout << i << ", " << rounds_required[i] << std::endl;
106+ // }
135107
136108 auto stats = calc_stats (rounds_required);
137109 std::cout << " avg = " << stats.first << " std dev = " << stats.second << std::endl;
138110 std::cout << " ingest: " << ingest_time.count () << std::endl;
139111 std::cout << " query: " << query_time.count () << std::endl;
140- std::cout << " filter: " << filter_time.count () << std::endl;
112+ std::cout << " sample: " << sample_time.count () << std::endl;
113+ std::cout << " delete: " << delete_time.count () << std::endl;
141114
142115 std::ofstream output_file (" rounds_required.txt" );
143116 output_file << " ERRORS = " << errors << std::endl;
@@ -149,5 +122,6 @@ int main(int argc, char **argv) {
149122 output_file << " std dev, " << stats.second << std::endl;
150123 output_file << " ingest: " << ingest_time.count () << std::endl;
151124 output_file << " query: " << query_time.count () << std::endl;
152- output_file << " filter: " << filter_time.count () << std::endl;
125+ output_file << " sample: " << sample_time.count () << std::endl;
126+ output_file << " delete: " << delete_time.count () << std::endl;
153127}
0 commit comments