🐞 fix(src): 修复append模式下,未开启fs2导致的段错误

This commit is contained in:
彭宣正
2021-07-06 10:27:36 +08:00
parent 696fcecb7c
commit 68f7b08a72
5 changed files with 48 additions and 33 deletions

View File

@@ -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;
}

View File

@@ -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
hos_fs2_format=0 #default
hos_request_num=0
hos_request_context=0

View File

@@ -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