summaryrefslogtreecommitdiffstats
path: root/benchmarks/include/file_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/include/file_util.h')
-rw-r--r--benchmarks/include/file_util.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/benchmarks/include/file_util.h b/benchmarks/include/file_util.h
index 2a3300a..ea8b42e 100644
--- a/benchmarks/include/file_util.h
+++ b/benchmarks/include/file_util.h
@@ -97,6 +97,22 @@ static std::vector<R> read_sosd_file(std::string &fname, size_t n) {
return records;
}
+template<typename K, typename V>
+static std::vector<std::pair<K, V>> read_sosd_file_pair(std::string &fname, size_t n) {
+ std::fstream file;
+ file.open(fname, std::ios::in | std::ios::binary);
+
+ std::vector<std::pair<K,V>> records(n);
+ for (size_t i=0; i<n; i++) {
+ uint64_t k;
+ file.read((char*) &(k), sizeof(uint64_t));
+ records[i].first = k;
+ records[i].second = i;
+ }
+
+ return records;
+}
+
/*
* This function expects a plaintext file with each vector on its own line.
* There should be D dimensions (or more) for each record, separated by