Now records speedup factor over naive

This commit is contained in:
Dongryeol Lee
2007-09-30 18:58:22 +00:00
parent b721d06b67
commit d81fa7b694
2 changed files with 11 additions and 4 deletions
+6
View File
@@ -32,6 +32,12 @@ int main(int argc, char *argv[]) {
printf("Both methods have different results...\n");
}
}
timer *tree_range_search_time = fx_timer(NULL, "tree_range_search");
timer *naive_search_time = fx_timer(NULL, "naive_search");
fx_format_result(NULL, "speedup", "%g",
((double)(naive_search_time->total).micros) /
((double)(tree_range_search_time->total).micros));
fx_done();
return 0;
}
@@ -12,8 +12,8 @@ class RangeReader {
TextTokenizer tokenizer;
const char *dname = fx_param_str(NULL, "range", "range.txt");
const double offset1 = fx_param_double(NULL, "offset1", 0);
const double offset2 = fx_param_double(NULL, "offset2", 0);
const double factor = fx_param_double(NULL, "factor", 1);
const double offset = fx_param_double(NULL, "offset", 0);
tokenizer.Open(dname);
for(index_t i = 0; i < range.size(); i++) {
@@ -51,8 +51,9 @@ class RangeReader {
}
// apply offset
range[i].lo -= offset1;
range[i].hi -= offset2;
range[i].lo -= offset;
range[i].hi -= offset;
range[i].hi = range[i].lo + (range[i].hi - range[i].lo) * factor;
printf("Got [ %g %g ]\n", range[i].lo, range[i].hi);