MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/benchmark/rosksdb/main.cpp:111–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111int main(int argc, char* argv[]) {
112 const char* dbpath = "./db";
113 int ch, max = 1000, nthread = 1;
114 acl::string action("get");
115
116 while ((ch = getopt(argc, argv, "hn:a:c:")) > 0) {
117 switch (ch) {
118 case 'h':
119 usage(argv[0]);
120 return 0;
121 case 'n':
122 max = atoi(optarg);
123 break;
124 case 'a':
125 action = optarg;
126 break;
127 case 'c':
128 nthread = atoi(optarg);
129 break;
130 default:
131 break;
132 }
133 }
134
135 std::vector<acl::thread*> threads;
136 for (int i = 0; i < nthread; i++) {
137 DB* db;
138 Options options;
139 options.IncreaseParallelism();
140 // options.OptimizeLevelStyleCompaction();
141 options.create_if_missing = true;
142
143 acl::string path;
144 path << dbpath << i;
145 Status s = DB::Open(options, path.c_str(), &db);
146 if (!s.ok()) {
147 printf("Open rockdb(%s) failed(%s)!\r\n",
148 dbpath, s.getState());
149 return 1;
150 }
151
152 acl::thread* thr = new db_thread(i, db, action, max);
153 threads.push_back(thr);
154 thr->start();
155 }
156
157 for (std::vector<acl::thread*>::iterator it = threads.begin();
158 it != threads.end(); ++it) {
159 (*it)->wait();
160 delete *it;
161 }
162
163 return 0;
164}

Callers

nothing calls this directly

Calls 8

beginMethod · 0.80
usageFunction · 0.70
getoptFunction · 0.50
c_strMethod · 0.45
push_backMethod · 0.45
startMethod · 0.45
endMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…