diff options
| author | 彭宣正 <[email protected]> | 2021-07-06 10:27:36 +0800 |
|---|---|---|
| committer | 彭宣正 <[email protected]> | 2021-07-06 10:27:36 +0800 |
| commit | 68f7b08a72b8879ae93bce38e9762c64e818be68 (patch) | |
| tree | 1091081f378b23ef2362d193108007f99beb8e06 /example | |
| parent | 696fcecb7c2a4d0bb5f908e3c4fd8b77ba830b0d (diff) | |
🐞 fix(src): 修复append模式下,未开启fs2导致的段错误v2.0.1
Diffstat (limited to 'example')
| -rw-r--r-- | example/performance/HosClientPerformance.cpp | 17 | ||||
| -rw-r--r-- | example/performance/conf/default.conf | 5 | ||||
| -rwxr-xr-x | example/performance/test.sh | 4 |
3 files changed, 19 insertions, 7 deletions
diff --git a/example/performance/HosClientPerformance.cpp b/example/performance/HosClientPerformance.cpp index 6eb3b774..35dfc4e1 100644 --- a/example/performance/HosClientPerformance.cpp +++ b/example/performance/HosClientPerformance.cpp @@ -132,7 +132,7 @@ static int upload_file(char *file, char *buff, int buff_len, thread_info_t *thre fp = fopen(file, "w+"); if (fp == NULL) { - printf("error:fopen failed\n"); + perror("error:fopen failed\n"); return -1; } if (fwrite(buff, buff_len, 1, fp) != 1) @@ -177,10 +177,21 @@ static int upload_file(char *file, char *buff, int buff_len, thread_info_t *thre } variance /= g_test_count; - sprintf(file_size, "%dk", buff_len / 1024); + if (buff_len > 1024 * 1024) + { + sprintf(file_size, "%gM", (double)buff_len / 1024 / 1024); + } + else if (buff_len > 1024) + { + sprintf(file_size, "%gK", (double)buff_len / 1024); + } + else + { + sprintf(file_size, "%dB", buff_len); + } sprintf(&performance_info[len], "%-20lu%-20s%-20ld%-20ld%-20lf%-20lf\n", thread_info->thread_num, file_size, time_write, time_upload, average, sqrt(variance)); - + return 0; } diff --git a/example/performance/conf/default.conf b/example/performance/conf/default.conf index 9f80e557..551a1ab5 100644 --- a/example/performance/conf/default.conf +++ b/example/performance/conf/default.conf @@ -9,8 +9,9 @@ hos_poolsize=100 #default hos_thread_sum=32 #default hos_cache_size=102400 #default hos_cache_count=10 #default -hos_fd_live_time_ms=1000 #default hos_fs2_serverip=127.0.0.1 hos_fs2_serverport=10086 hos_fs2_path="./hos_fs2_log" #default -hos_fs2_format=0 #default
\ No newline at end of file +hos_fs2_format=0 #default +hos_request_num=0 +hos_request_context=0 diff --git a/example/performance/test.sh b/example/performance/test.sh index 16948150..5a291676 100755 --- a/example/performance/test.sh +++ b/example/performance/test.sh @@ -21,7 +21,7 @@ do #./HosClientPerformance -a 100 -A -f ./file/100k.data -t ${size[$num]} -S 1024 #echo ./HosClientPerformance -a 100 -A -f ./file/100k.data -S ${size[$num]} -t 32 #./HosClientPerformance -a 100 -A -f ./file/100k.data -S ${size[$num]} -t 32 - echo ./HosClientPerformance -P1 -t32 - ./HosClientPerformance -P1 -t32 + echo ./HosClientPerformance -t ${num} -f ../file/100.data + ./HosClientPerformance -t ${num} -f ../file/100.data let "num++" done |
