return oss.str();
}
-static void sanitize_object_contents (bench_data *data, int length) {
+static void sanitize_object_contents (bench_data *data, size_t length) {
memset(data->object_contents, 'z', length);
}
int ObjBencher::aio_bench(
int operation, int secondsToRun,
- int concurrentios, int object_size, bool cleanup, const std::string& run_name, bool no_verify) {
+ int concurrentios, size_t object_size, bool cleanup, const std::string& run_name, bool no_verify) {
if (concurrentios <= 0)
return -EINVAL;
return sqrt(stddev);
}
-int ObjBencher::fetch_bench_metadata(const std::string& metadata_file, int* object_size, int* num_objects, int* prevPid) {
+int ObjBencher::fetch_bench_metadata(const std::string& metadata_file, size_t* object_size, int* num_objects, int* prevPid) {
int r = 0;
bufferlist object_data;
- r = sync_read(metadata_file, object_data, sizeof(int)*3);
+ r = sync_read(metadata_file, object_data, sizeof(int) * 2 + sizeof(size_t));
if (r <= 0) {
// treat an empty file as a file that does not exist
if (r == 0) {
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) {
+ if ( (cur_contents->length() != data.object_size) ||
+ (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) ) {
cerr << name[slot] << " is not correct!" << std::endl;
++errors;
}
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;
}
- 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.min_latency) data.min_latency = data.cur_latency;
if (!no_verify) {
snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", index[slot]);
lock.Unlock();
- if (memcmp(data.object_contents, contents[slot]->c_str(), data.object_size) != 0) {
+ if ((contents[slot]->length() != data.object_size) ||
+ (memcmp(data.object_contents, contents[slot]->c_str(), data.object_size) != 0)) {
cerr << name[slot] << " is not correct!" << std::endl;
++errors;
}
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) {
+ if ((cur_contents->length() != data.object_size) ||
+ (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0)) {
cerr << name[slot] << " is not correct!" << std::endl;
++errors;
}
if (!no_verify) {
snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", index[slot]);
lock.Unlock();
- if (memcmp(data.object_contents, contents[slot]->c_str(), data.object_size) != 0) {
+ if ((contents[slot]->length() != data.object_size) ||
+ (memcmp(data.object_contents, contents[slot]->c_str(), data.object_size) != 0)) {
cerr << name[slot] << " is not correct!" << std::endl;
++errors;
}
int ObjBencher::clean_up(const std::string& prefix, int concurrentios, const std::string& run_name) {
int r = 0;
- int object_size;
+ size_t object_size;
int num_objects;
int prevPid;
struct bench_data {
bool done; //is the benchmark is done
- int object_size; //the size of the objects
+ size_t object_size; //the size of the objects
// same as object_size for write tests
int in_flight; //number of reads/writes being waited on
int started;
struct bench_data data;
- int fetch_bench_metadata(const std::string& metadata_file, int* object_size, int* num_objects, int* prevPid);
+ int fetch_bench_metadata(const std::string& metadata_file, size_t* object_size, int* num_objects, int* prevPid);
int write_bench(int secondsToRun, int concurrentios, const string& run_name_meta);
int seq_read_bench(int secondsToRun, int num_objects, int concurrentios, int writePid, bool no_verify=false);
virtual ~ObjBencher() {}
int aio_bench(
int operation, int secondsToRun,
- int concurrentios, int op_size, bool cleanup, const std::string& run_name, bool no_verify=false);
+ int concurrentios, size_t op_size, bool cleanup, const std::string& run_name, bool no_verify=false);
int clean_up(const std::string& prefix, int concurrentios, const std::string& run_name);
void set_show_time(bool dt) {