}
-SyntheticClient::SyntheticClient(Client *client, int w)
+SyntheticClient::SyntheticClient(Client *client, int w)
{
this->client = client;
whoami = w;
this->iargs = syn_iargs;
this->sargs = syn_sargs;
- run_start = ceph_clock_now(g_ceph_context);
+ run_start = ceph_clock_now(client->cct);
}
return -1;
}
- //run_start = ceph_clock_now(g_ceph_context);
+ //run_start = ceph_clock_now(client->cct);
run_until = utime_t(0,0);
dout(5) << "run" << dendl;
iargs.pop_front();
if (iarg1 && run_me()) {
dout(2) << "sleepuntil " << iarg1 << dendl;
- utime_t at = ceph_clock_now(g_ceph_context) - run_start;
+ utime_t at = ceph_clock_now(client->cct) - run_start;
if (at.sec() < iarg1)
sleep(iarg1 - at.sec());
}
if (iarg1 == 0) iarg1 = 1; // play trace at least once!
for (int i=0; i<iarg1; i++) {
- utime_t start = ceph_clock_now(g_ceph_context);
+ utime_t start = ceph_clock_now(client->cct);
if (time_to_stop()) break;
play_trace(t, prefix, !playdata);
if (time_to_stop()) break;
if (iarg1 > 1) clean_dir(prefix); // clean only if repeat
- utime_t lat = ceph_clock_now(g_ceph_context);
+ utime_t lat = ceph_clock_now(client->cct);
lat -= start;
dout(0) << " trace " << tfile << " loop " << (i+1) << "/" << iarg1 << " done in " << (double)lat << " seconds" << dendl;
char buf[1024];
char buf2[1024];
- utime_t start = ceph_clock_now(g_ceph_context);
+ utime_t start = ceph_clock_now(client->cct);
hash_map<int64_t, int64_t> open_files;
hash_map<int64_t, dir_result_t*> open_dirs;
Cond cond;
bool ack;
bool safe;
- C_GatherBuilder safeg(g_ceph_context, new C_SafeCond(&lock, &cond, &safe));
+ C_GatherBuilder safeg(client->cct, new C_SafeCond(&lock, &cond, &safe));
Context *safegref = safeg.new_sub(); // take a ref
while (!t.end()) {
bufferlist bl;
bl.push_back(bp);
SnapContext snapc;
- client->objecter->write(oid, oloc, off, len, snapc, bl, ceph_clock_now(g_ceph_context), 0,
+ client->objecter->write(oid, oloc, off, len, snapc, bl, ceph_clock_now(client->cct), 0,
new C_SafeCond(&lock, &cond, &ack),
safeg.new_sub());
safeg.activate();
object_locator_t oloc(CEPH_DATA_RULE);
lock.Lock();
SnapContext snapc;
- client->objecter->zero(oid, oloc, off, len, snapc, ceph_clock_now(g_ceph_context), 0,
+ client->objecter->zero(oid, oloc, off, len, snapc, ceph_clock_now(client->cct), 0,
new C_SafeCond(&lock, &cond, &ack),
safeg.new_sub());
safeg.activate();
dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
list<string> contents;
- utime_t s = ceph_clock_now(g_ceph_context);
+ utime_t s = ceph_clock_now(client->cct);
int r = client->getdir(basedir, contents);
- utime_t e = ceph_clock_now(g_ceph_context);
+ utime_t e = ceph_clock_now(client->cct);
e -= s;
if (r < 0) {
dout(0) << "read_dirs couldn't readdir " << basedir << ", stopping" << dendl;
for (int i=0; i<files; i++) {
snprintf(d, sizeof(d), "%s/file.%d", basedir, i);
- utime_t s = ceph_clock_now(g_ceph_context);
+ utime_t s = ceph_clock_now(client->cct);
if (client->lstat(d, &st) < 0) {
dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl;
return -1;
}
- utime_t e = ceph_clock_now(g_ceph_context);
+ utime_t e = ceph_clock_now(client->cct);
e -= s;
}
// files
struct stat st;
- utime_t start = ceph_clock_now(g_ceph_context);
+ utime_t start = ceph_clock_now(client->cct);
for (int c=0; c<count; c++) {
for (int n=0; n<num; n++) {
snprintf(d, sizeof(d), "dir.%d.run%d/file.client%d.%d", priv ? whoami:0, c, whoami, n);
if (time_to_stop()) return 0;
}
}
- utime_t end = ceph_clock_now(g_ceph_context);
+ utime_t end = ceph_clock_now(client->cct);
end -= start;
dout(0) << "makefiles time is " << end << " or " << ((double)end / (double)num) <<" per file" << dendl;
client->mkdir("orig", 0755);
client->mkdir("copy", 0755);
- utime_t start = ceph_clock_now(g_ceph_context);
+ utime_t start = ceph_clock_now(client->cct);
for (int i=0; i<num; i++) {
snprintf(d, sizeof(d), "orig/file.%d", i);
client->mknod(d, 0755);
}
- utime_t end = ceph_clock_now(g_ceph_context);
+ utime_t end = ceph_clock_now(client->cct);
end -= start;
dout(0) << "orig " << end << dendl;
// link
- start = ceph_clock_now(g_ceph_context);
+ start = ceph_clock_now(client->cct);
for (int i=0; i<num; i++) {
snprintf(d, sizeof(d), "orig/file.%d", i);
snprintf(e, sizeof(e), "copy/file.%d", i);
client->link(d, e);
}
- end = ceph_clock_now(g_ceph_context);
+ end = ceph_clock_now(client->cct);
end -= start;
dout(0) << "copy " << end << dendl;
return fd;
}
- utime_t from = ceph_clock_now(g_ceph_context);
+ utime_t from = ceph_clock_now(client->cct);
utime_t start = from;
uint64_t bytes = 0, total = 0;
bytes += wrsize;
total += wrsize;
- utime_t now = ceph_clock_now(g_ceph_context);
+ utime_t now = ceph_clock_now(client->cct);
if (now - from >= 1.0) {
double el = now - from;
dout(0) << "write " << (bytes / el / 1048576.0) << " MB/sec" << dendl;
client->fsync(fd, true);
- utime_t stop = ceph_clock_now(g_ceph_context);
+ utime_t stop = ceph_clock_now(client->cct);
double el = stop - start;
dout(0) << "write total " << (total / el / 1048576.0) << " MB/sec ("
<< total << " bytes in " << el << " seconds)" << dendl;
return fd;
}
- utime_t from = ceph_clock_now(g_ceph_context);
+ utime_t from = ceph_clock_now(client->cct);
utime_t start = from;
uint64_t bytes = 0, total = 0;
bytes += rdsize;
total += rdsize;
- utime_t now = ceph_clock_now(g_ceph_context);
+ utime_t now = ceph_clock_now(client->cct);
if (now - from >= 1.0) {
double el = now - from;
dout(0) << "read " << (bytes / el / 1048576.0) << " MB/sec" << dendl;
dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
}
- utime_t stop = ceph_clock_now(g_ceph_context);
+ utime_t stop = ceph_clock_now(client->cct);
double el = stop - start;
dout(0) << "read total " << (total / el / 1048576.0) << " MB/sec ("
<< total << " bytes in " << el << " seconds)" << dendl;
int SyntheticClient::create_objects(int nobj, int osize, int inflight)
{
// divy up
- int numc = g_conf->num_client ? g_conf->num_client : 1;
+ int numc = client->cct->_conf->num_client ? client->cct->_conf->num_client : 1;
int start, inc, end;
}
dout(10) << "writing " << oid << dendl;
- starts.push_back(ceph_clock_now(g_ceph_context));
+ starts.push_back(ceph_clock_now(client->cct));
client->client_lock.Lock();
- client->objecter->write(oid, oloc, 0, osize, snapc, bl, ceph_clock_now(g_ceph_context), 0,
+ client->objecter->write(oid, oloc, 0, osize, snapc, bl, ceph_clock_now(client->cct), 0,
new C_Ref(lock, cond, &unack),
new C_Ref(lock, cond, &unsafe));
client->client_lock.Unlock();
}
lock.Unlock();
- utime_t lat = ceph_clock_now(g_ceph_context);
+ utime_t lat = ceph_clock_now(client->cct);
lat -= starts.front();
starts.pop_front();
}
SnapContext snapc;
client->client_lock.Lock();
- utime_t start = ceph_clock_now(g_ceph_context);
+ utime_t start = ceph_clock_now(client->cct);
if (write) {
dout(10) << "write to " << oid << dendl;
op.op.op = CEPH_OSD_OP_STARTSYNC;
m.ops.push_back(op);
}
- client->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(g_ceph_context), 0,
+ client->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(client->cct), 0,
NULL, new C_Ref(lock, cond, &unack));
/*client->objecter->write(oid, layout, 0, osize, snapc, bl, 0,
new C_Ref(lock, cond, &unack),
}
lock.Unlock();
- utime_t lat = ceph_clock_now(g_ceph_context);
+ utime_t lat = ceph_clock_now(client->cct);
lat -= start;
if (client->logger) {
if (write)
if (sp < 0) dirnum++;
//dout(0) << "leading dir " << filename << " " << dirnum << dendl;
- if (dirnum % g_conf->num_client != client->get_nodeid()) {
+ if (dirnum % client->cct->_conf->num_client != client->get_nodeid()) {
dout(20) << "skipping leading dir " << dirnum << " " << filename << dendl;
continue;
}