Add some directory structure
Change-Id: I052849c6aff9fd0f311984de67c35a306735c9a9
diff --git a/examples/dumppmicubed.cc b/examples/dumppmicubed.cc
new file mode 100644
index 0000000..8c3bf56
--- /dev/null
+++ b/examples/dumppmicubed.cc
@@ -0,0 +1,46 @@
+#include <typeinfo>
+#include <assert.h>
+#include <memory>
+#include <iostream>
+#include <stdint.h>
+#include "../src/collocatordb.h"
+#include <thread>
+#include <chrono>
+#include <sstream> // for ostringstream
+#include <fstream>
+
+using namespace rocksdb;
+
+
+int main(int argc, char** argv) {
+ const int START=1;
+ const int STOP=300000;
+ uint32_t *array;
+ int done = 0;
+
+ array = (uint32_t *)malloc(STOP * 20 * sizeof(uint32_t));
+ memset(array, 0, STOP * 20 * sizeof(uint32_t));
+ FILE* pFile;
+ CollocatorDB cdb = CollocatorDB(argv[1], true);
+ std::cerr << "Database " << argv[1] << " opened\n";
+ #pragma omp parallel for schedule(dynamic, 1)
+ for(uint32_t i=START; i< STOP; i++) {
+ std::vector<rocksdb::Collocator> cs = cdb.get_collocators(i, STOP);
+ int j=0;
+ for (rocksdb::Collocator c : cs) {
+ if(c.w2 != i) {
+ array[i*20+j] = (uint32_t) c.w2;
+ if(++j >=20)
+ break;
+ }
+ }
+ if(done++ % 100 == 0) {
+ std::cerr <<"\r\033[2K"<<std::flush;
+ std::cerr << "done: " << done * 100.0 / (STOP-START) << "%" << " (todo: " << STOP-START-done << ")" << std::flush;
+ }
+ }
+ pFile = fopen("file.binary", "wb");
+ fwrite(array, sizeof(uint32_t), STOP*20, pFile);
+ fclose(pFile);
+ std::cout << std::flush;
+}