}
lc.cond.Wait(lock);
}
- lock.Unlock();
- newName = generate_object_name(data.started, pid);
+
+ // calculate latency here, so memcmp doesn't inflate it
+ data.cur_latency = ceph_clock_now(cct) - start_times[slot];
+
+ cur_contents = contents[slot];
int current_index = index[slot];
+
+ // invalidate internal crc cache
+ cur_contents->invalidate_crc();
+
+ if (!no_verify) {
+ snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", current_index);
+ if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
+ cerr << name[slot] << " is not correct!" << std::endl;
+ ++errors;
+ }
+ }
+
+ newName = generate_object_name(data.started, pid);
index[slot] = data.started;
+ lock.Unlock();
completion_wait(slot);
- lock.Lock();
r = completion_ret(slot);
if (r < 0) {
cerr << "read got " << r << std::endl;
lock.Unlock();
goto ERR;
}
- data.cur_latency = ceph_clock_now(cct) - start_times[slot];
+ lock.Lock();
total_latency += data.cur_latency;
- if( data.cur_latency > data.max_latency) data.max_latency = data.cur_latency;
+ if (data.cur_latency > data.max_latency) data.max_latency = data.cur_latency;
if (data.cur_latency < data.min_latency) data.min_latency = data.cur_latency;
++data.finished;
data.avg_latency = total_latency / data.finished;
--data.in_flight;
lock.Unlock();
release_completion(slot);
- cur_contents = contents[slot];
-
- // invalidate internal crc cache
- cur_contents->invalidate_crc();
//start new read and check data if requested
start_times[slot] = ceph_clock_now(cct);
lock.Lock();
++data.started;
++data.in_flight;
- if (!no_verify) {
- snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", current_index);
lock.Unlock();
- if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
- cerr << name[slot] << " is not correct!" << std::endl;
- ++errors;
- }
+ if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
+ cerr << name[slot] << " is not correct!" << std::endl;
+ ++errors;
} else {
lock.Unlock();
}
}
lc.cond.Wait(lock);
}
+
+ // calculate latency here, so memcmp doesn't inflate it
+ data.cur_latency = ceph_clock_now(cct) - start_times[slot];
+
lock.Unlock();
- rand_id = rand() % num_objects;
- newName = generate_object_name(rand_id, pid);
+
int current_index = index[slot];
- index[slot] = rand_id;
+ cur_contents = contents[slot];
completion_wait(slot);
lock.Lock();
r = completion_ret(slot);
lock.Unlock();
goto ERR;
}
- data.cur_latency = ceph_clock_now(g_ceph_context) - start_times[slot];
+
total_latency += data.cur_latency;
- if( data.cur_latency > data.max_latency) data.max_latency = data.cur_latency;
+ if (data.cur_latency > data.max_latency) data.max_latency = data.cur_latency;
if (data.cur_latency < data.min_latency) data.min_latency = data.cur_latency;
++data.finished;
data.avg_latency = total_latency / data.finished;
--data.in_flight;
lock.Unlock();
+
+ if (!no_verify) {
+ snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", current_index);
+ if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
+ cerr << name[slot] << " is not correct!" << std::endl;
+ ++errors;
+ }
+ }
+
+ rand_id = rand() % num_objects;
+ newName = generate_object_name(rand_id, pid);
+ index[slot] = rand_id;
release_completion(slot);
- cur_contents = contents[slot];
// invalidate internal crc cache
cur_contents->invalidate_crc();
lock.Lock();
++data.started;
++data.in_flight;
- if (!no_verify) {
- snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", current_index);
- lock.Unlock();
- if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
- cerr << name[slot] << " is not correct!" << std::endl;
- ++errors;
- }
- } else {
- lock.Unlock();
- }
+ lock.Unlock();
name[slot] = newName;
}
+
//wait for final reads to complete
while (data.finished < data.started) {
slot = data.finished % concurrentios;