summaryrefslogtreecommitdiff
path: root/example/performance
diff options
context:
space:
mode:
authorpengxuanzheng <[email protected]>2020-10-22 16:34:08 +0800
committerpengxuanzheng <[email protected]>2020-11-02 19:00:30 +0800
commit822ea4c65fa88792019027c629e3090ac7386cd6 (patch)
treeff24f9625002fdfece7a785e2141965ab2e2ee14 /example/performance
parent8ba2e43c9e468dae6aaf72ae112752d0a2e267e8 (diff)
修改aws SDK
Diffstat (limited to 'example/performance')
-rw-r--r--example/performance/HosClientPerformance.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/example/performance/HosClientPerformance.cpp b/example/performance/HosClientPerformance.cpp
index 3b42b892..4f7d4c4a 100644
--- a/example/performance/HosClientPerformance.cpp
+++ b/example/performance/HosClientPerformance.cpp
@@ -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;
char file_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
size_t time_tmp = 0;
while(1)
@@ -248,6 +248,7 @@ static int upload_buff(char * buff, int buff_len, int test_times, thread_info_t
#else
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);
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);
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");
- drop_cnt++;
+ success_cnt++;
+ }else
+ {
+ printf("error code:%d\n", ret);
}
}
clock_gettime(CLOCK_MONOTONIC, &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(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);
}
-
#endif
hos_close_fd(fd, thread_info->thread_num);
@@ -437,7 +444,7 @@ int main(int argc, char *argv[])
break;
case 'p':
conf.pool_size = atoi(optarg);
- conf.pool_size = MIN(3000, conf.pool_size);
+ conf.pool_size = MIN(4000, conf.pool_size);
break;
case 't':
conf.thread_sum = atoi(optarg);
@@ -484,6 +491,9 @@ int main(int argc, char *argv[])
return -1;
}
+ set_thread_sum(handle, conf.thread_sum);
+ set_cache_size(handle, conf.append_size);
+
//创建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");
}
+ hos_expand_fs2(handle, "./log/fs2.log", 0, "127.0.0.1", 8001);
for ( thread_num = 0; thread_num < conf.thread_sum; thread_num++ )
{
thread_info[thread_num].conf = conf;