MCPcopy Create free account
hub / github.com/Stream-AD/MIDAS / NumRecordVsTime

Function NumRecordVsTime

example/Experiment.cpp:140–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void NumRecordVsTime(int numColumn, float threshold, const std::vector<int>& numsRecord, int numRepeat, const int* source, const int* destination, const int* timestamp) {
141 const auto time = new long long[numsRecord.size() * numRepeat];
142 const auto seed = new int[numRepeat];
143 std::for_each(seed, seed + numRepeat, [](int& a) { a = rand(); });
144 for (int i = 0; i < numsRecord.size(); i++) {
145 for (int j = 0; j < numRepeat; j++) {
146 srand(seed[j]);
147 // MIDAS::NormalCore midas(2, numColumn);
148 // MIDAS::RelationalCore midas(2, numColumn);
149 MIDAS::FilteringCore midas(2, numColumn, threshold);
150 const auto timeBegin = std::chrono::high_resolution_clock::now();
151 for (int k = 0; k < numsRecord[i]; k++)
152 midas(source[k], destination[k], timestamp[k]);
153 printf("Time%03d = %lldus\n", j, time[i * numRepeat + j] = duration_cast<microseconds>(high_resolution_clock::now() - timeBegin).count());
154 }
155 printf("// Above results use numRecord = %d\n", numsRecord[i]);
156 }
157 const auto fileExperimentResult = fopen(SOLUTION_DIR"temp/Experiment.csv", "w");
158 fprintf(fileExperimentResult, "numColumn,threshold,numRecord,seed,time\n"); // Microsecond (us), other tests are millisecond (ms)
159 for (int i = 0; i < numsRecord.size(); i++)
160 for (int j = 0; j < numRepeat; j++)
161 fprintf(fileExperimentResult, "%d,%g,%d,%d,%lld\n", numColumn, threshold, numsRecord[i], seed[j], time[i * numRepeat + j]);
162 fclose(fileExperimentResult);
163 delete[] time;
164 delete[] seed;
165}
166
167void NumColumnVsTime(int n, const std::vector<int>& numsColumn, float threshold, int numRepeat, const int* source, const int* destination, const int* timestamp) {
168 const auto time = new long long[numsColumn.size() * numRepeat];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected