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

Function main

lib_acl_cpp/samples/benchmark/sqlite/main.cpp:150–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150int main(int argc, char* argv[]) {
151 int nthreads = 1, max = 1000, ch;
152 acl::string dbpath = "./var", libpath = "./libsqlite3.so";
153 acl::string action = "get";
154 acl::string addr = "127.0.0.1:7343";
155
156 while ((ch = getopt(argc, argv, "hn:c:p:l:s:a:")) > 0) {
157 switch (ch) {
158 case 'h':
159 usage(argv[0]);
160 return 0;
161 case 'n':
162 max = atoi(optarg);
163 break;
164 case 'c':
165 nthreads = atoi(optarg);
166 break;
167 case 'p':
168 dbpath = optarg;
169 break;
170 case 'l':
171 libpath = optarg;
172 break;
173 case 's':
174 addr = optarg;
175 break;
176 case 'a':
177 action = optarg;
178 break;
179 default:
180 break;
181 }
182 }
183
184 if (access(libpath.c_str(), R_OK) == -1) {
185 printf("access %s failed %s\r\n", libpath.c_str(), acl::last_serror());
186 return 1;
187 }
188
189 acl::log::stdout_open(true);
190 acl::db_handle::set_loadpath(libpath);
191
192 acl::atomic_long success;
193
194 std::vector<acl::thread*> threads;
195 for (int i = 0; i < nthreads; i++) {
196 acl::string path;
197 path << dbpath << "/" << "db" << i << ".db";
198 acl::thread* thr = new dbthread(path, action, max, success);
199 threads.push_back(thr);
200 thr->start();
201 }
202
203 for (std::vector<acl::thread*>::iterator it = threads.begin();
204 it != threads.end(); ++it) {
205
206 (*it)->wait();
207 delete *it;

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…