添加upload接口的demo

This commit is contained in:
pengxuanzheng
2020-10-09 14:19:37 +08:00
parent 13da2f2bc6
commit 76477b253d
3 changed files with 12 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_BUILD_TYPE Debug)
project(hos_write_complete)
project(hos_upload_complete)
SET(CMAKE_BUILD_TYPE Debug)
link_directories(/usr/local/lib64/)
@@ -9,5 +10,7 @@ link_libraries(hos-client-cpp)
include_directories(/opt/MESA/include)
add_executable(hos_write_complete hos_write_complete.cpp)
add_executable(hos_upload_complete hos_upload_complete.cpp)
target_link_libraries(hos_write_complete hos-client-cpp)
target_link_libraries(hos_upload_complete hos-client-cpp)

View File

@@ -4,13 +4,15 @@
# Created Time: Mon 21 Sep 2020 04:43:35 PM CST
#########################################################################
#!/bin/bash
test_size=("1k" "10k" "100k" "1M" "2M" "3M" "4M")
test_size=("1k" "10k" "100k" "1M" "2M" "3M" "4M" "5M" "10M" "20M" "30M")
num=0
while((${num} < 7))
while((${num} < 11))
do
echo ./hos_write_complete mybucket ${test_size[$num]}.data 1000
./hos_write_complete mybucket ${test_size[$num]}.data 1000
#echo ./hos_write_complete mybucket ${test_size[$num]}.data 10000
#./hos_write_complete mybucket ${test_size[$num]}.data 10000
echo ./hos_upload_complete mybucket ${test_size[$num]}.data 10000
./hos_upload_complete mybucket ${test_size[$num]}.data 10000
let "num++"
done

View File

@@ -106,13 +106,12 @@ int main(int argc, char *argv[])
}
debuginfo("hos_verify_bucket success ... \n");
#if 0
fd = hos_open_fd(handle, bucket, object, callback, (void *)&data, 0, mode);
#if 1
debuginfo("hos_upload_file start ...\n");
clock_gettime(CLOCK_MONOTONIC, &start);
for (i = 0; i < test_times; i++)
{
hos_write(fd, object, 0, 0);
hos_upload_file(handle, bucket, object, callback, (void *)&data, 0);
}
clock_gettime(CLOCK_MONOTONIC, &end);
time = calc_time(start, end);
@@ -121,16 +120,11 @@ int main(int argc, char *argv[])
debuginfo("hos_upload_file end ...\n");
#else
mode = BUFF_MODE;
for (i = 0; i < 10000; i++)
{
fd[i] = hos_open_fd(handle, bucket, object, callback, (void *)&data, 0, mode);
}
debuginfo("hos_upload_buf start ...\n");
clock_gettime(CLOCK_MONOTONIC, &start);
for (i = 0; i < test_times; i++)
{
hos_write(fd[i], buf, buf_size, 0);
hos_upload_buf(handle, bucket, object, buf, buf_len, callback, (void *)&data, 0);
}
clock_gettime(CLOCK_MONOTONIC, &end);
time = calc_time(start, end);