summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rwxr-xr-xexample/demo/data/hos_upload_completebin17208 -> 0 bytes
-rwxr-xr-xexample/demo/data/hos_write_completebin17360 -> 0 bytes
-rw-r--r--example/performance/HosClientPerformance.cpp27
3 files changed, 19 insertions, 8 deletions
diff --git a/example/demo/data/hos_upload_complete b/example/demo/data/hos_upload_complete
deleted file mode 100755
index 045f53b2..00000000
--- a/example/demo/data/hos_upload_complete
+++ /dev/null
Binary files differ
diff --git a/example/demo/data/hos_write_complete b/example/demo/data/hos_write_complete
deleted file mode 100755
index 2738dc46..00000000
--- a/example/demo/data/hos_write_complete
+++ /dev/null
Binary files differ
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;