修改aws SDK

This commit is contained in:
pengxuanzheng
2020-10-22 16:34:08 +08:00
parent 8ba2e43c9e
commit 822ea4c65f
5 changed files with 21 additions and 9 deletions

Binary file not shown.

View File

@@ -199,9 +199,9 @@ static int upload_buff(char * buff, int buff_len, int test_times, thread_info_t
conf_t *conf = &thread_info->conf; conf_t *conf = &thread_info->conf;
char file_size[128]; char file_size[128];
char append_size[128]; char append_size[128];
size_t drop_cnt = 0; size_t success_cnt = 0;
int ret = 0;
fd = hos_open_fd(thread_info->handle, conf->bucket, conf->object, callback, NULL, thread_info->thread_num, conf->mode);
#if 0 #if 0
size_t time_tmp = 0; size_t time_tmp = 0;
while(1) while(1)
@@ -248,6 +248,7 @@ static int upload_buff(char * buff, int buff_len, int test_times, thread_info_t
#else #else
if (conf->mode & APPEND_MODE) if (conf->mode & APPEND_MODE)
{ {
fd = hos_open_fd(thread_info->handle, conf->bucket, conf->object, callback, NULL, thread_info->thread_num, conf->mode);
clock_gettime(CLOCK_MONOTONIC, &tstart); clock_gettime(CLOCK_MONOTONIC, &tstart);
for (i = 0; i < test_times; i++) for (i = 0; i < test_times; i++)
{ {
@@ -278,15 +279,22 @@ static int upload_buff(char * buff, int buff_len, int test_times, thread_info_t
clock_gettime(CLOCK_MONOTONIC, &tstart); clock_gettime(CLOCK_MONOTONIC, &tstart);
for (i = 0; i < test_times; i++) for (i = 0; i < test_times; i++)
{ {
if (hos_write(fd, buff, buff_len, thread_info->thread_num) != HOS_CLIENT_OK) fd = hos_open_fd(thread_info->handle, conf->bucket, conf->object, callback, NULL, thread_info->thread_num, conf->mode);
ret = hos_write(fd, buff, buff_len, thread_info->thread_num);
if (ret == HOS_CLIENT_OK)
{ {
//printf("error: hos_write error\n"); success_cnt++;
drop_cnt++; }else
{
printf("error code:%d\n", ret);
} }
} }
clock_gettime(CLOCK_MONOTONIC, &ttmp); clock_gettime(CLOCK_MONOTONIC, &ttmp);
time = calc_time(tstart, ttmp); time = calc_time(tstart, ttmp);
time /= (test_times - drop_cnt); if (success_cnt)
time /= success_cnt;
else
time /= test_times;
sprintf(file_size, "%dk", buff_len / 1024); sprintf(file_size, "%dk", buff_len / 1024);
sprintf(append_size, "%luk", conf->append_size / 1024); sprintf(append_size, "%luk", conf->append_size / 1024);
@@ -295,7 +303,6 @@ static int upload_buff(char * buff, int buff_len, int test_times, thread_info_t
thread_info->thread_num, file_size, 0, 0, time); thread_info->thread_num, file_size, 0, 0, time);
} }
#endif #endif
hos_close_fd(fd, thread_info->thread_num); hos_close_fd(fd, thread_info->thread_num);
@@ -437,7 +444,7 @@ int main(int argc, char *argv[])
break; break;
case 'p': case 'p':
conf.pool_size = atoi(optarg); conf.pool_size = atoi(optarg);
conf.pool_size = MIN(3000, conf.pool_size); conf.pool_size = MIN(4000, conf.pool_size);
break; break;
case 't': case 't':
conf.thread_sum = atoi(optarg); conf.thread_sum = atoi(optarg);
@@ -484,6 +491,9 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
set_thread_sum(handle, conf.thread_sum);
set_cache_size(handle, conf.append_size);
//创建bucket //创建bucket
if (hos_create_bucket(handle, conf.bucket)) if (hos_create_bucket(handle, conf.bucket))
{ {
@@ -501,6 +511,7 @@ int main(int argc, char *argv[])
{ {
printf("%-20s%-20s%-20s%-20s%-20s\n", "thread_id", "file_size", "write_time", "upload_time", "total_time"); printf("%-20s%-20s%-20s%-20s%-20s\n", "thread_id", "file_size", "write_time", "upload_time", "total_time");
} }
hos_expand_fs2(handle, "./log/fs2.log", 0, "127.0.0.1", 8001);
for ( thread_num = 0; thread_num < conf.thread_sum; thread_num++ ) for ( thread_num = 0; thread_num < conf.thread_sum; thread_num++ )
{ {
thread_info[thread_num].conf = conf; thread_info[thread_num].conf = conf;

View File

@@ -3,7 +3,8 @@ include(ExternalProject)
set(AWSS3_ROOT ${CMAKE_CURRENT_BINARY_DIR}) set(AWSS3_ROOT ${CMAKE_CURRENT_BINARY_DIR})
set(AWSS3_URL ${CMAKE_CURRENT_SOURCE_DIR}/aws-sdk-cpp-master.zip) set(AWSS3_URL ${CMAKE_CURRENT_SOURCE_DIR}/aws-sdk-cpp-master.zip)
#set(AWSS3_URL_MD5 a94cce4fe5003acf55fe1eac8c49ad4f) #set(AWSS3_URL_MD5 a94cce4fe5003acf55fe1eac8c49ad4f)
set(AWSS3_URL_MD5 9128a9cc628a24f0c2f8b19e36d8327c) set(AWSS3_URL_MD5 dcdcd3cd6d2864f7efbfa90db6f5bf32)
#set(AWSS3_URL_MD5 1bb2784d5f39ff05fcf2c30092dc8a66)
set(AWSS3_CONFIGURE cd ${AWSS3_ROOT}/aws-sdk-cpp-master/src/aws-sdk-cpp-master && cmake . -DBUILD_ONLY=s3 -DCMAKE_BUILD_TYPE=Debug) set(AWSS3_CONFIGURE cd ${AWSS3_ROOT}/aws-sdk-cpp-master/src/aws-sdk-cpp-master && cmake . -DBUILD_ONLY=s3 -DCMAKE_BUILD_TYPE=Debug)
set(AWSS3_MAKE cd ${AWSS3_ROOT}/aws-sdk-cpp-master/src/aws-sdk-cpp-master && make) set(AWSS3_MAKE cd ${AWSS3_ROOT}/aws-sdk-cpp-master/src/aws-sdk-cpp-master && make)
set(AWSS3_INSTALL cd ${AWSS3_ROOT}/aws-sdk-cpp-master/src/aws-sdk-cpp-master && make install PREFIX=${SUPPORT_INSTALL_PREFIX}) set(AWSS3_INSTALL cd ${AWSS3_ROOT}/aws-sdk-cpp-master/src/aws-sdk-cpp-master && make install PREFIX=${SUPPORT_INSTALL_PREFIX})

Binary file not shown.