mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
benchmarks/apib: the port had been updated (+)
- Belatedly update to version 1.2.1 and sync port description - Builds with CMake now and uses modern libraries instead of the Apache Portable Runtime (devel/apr1) - While upstream asks for C++11, force C++17 because that's how Abseil C++ libraries are currently built, otherwise it won't link due to ABI incompatibilities - Hook two provided tests to our framework (USES+=cmake:testing)
This commit is contained in:
parent
8434e64540
commit
0fdebe53ba
7 changed files with 114 additions and 128 deletions
|
@ -1,8 +1,9 @@
|
||||||
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
|
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
|
||||||
|
|
||||||
PORTNAME= apib
|
PORTNAME= apib
|
||||||
PORTVERSION= 1.0
|
DISTVERSIONPREFIX= ${PORTNAME:tu}_
|
||||||
PORTREVISION= 3
|
DISTVERSION= 1_2_1
|
||||||
|
DISTVERSIONSUFFIX= _RC1
|
||||||
CATEGORIES= benchmarks www
|
CATEGORIES= benchmarks www
|
||||||
|
|
||||||
MAINTAINER= danfe@FreeBSD.org
|
MAINTAINER= danfe@FreeBSD.org
|
||||||
|
@ -10,29 +11,21 @@ COMMENT= Simple and fast HTTP performance testing tool
|
||||||
|
|
||||||
LICENSE= APACHE20
|
LICENSE= APACHE20
|
||||||
|
|
||||||
LIB_DEPENDS= libapr-1.so:devel/apr1
|
LIB_DEPENDS= libabsl_base.so:devel/abseil \
|
||||||
|
libev.so:devel/libev \
|
||||||
|
libgtest.so:devel/googletest \
|
||||||
|
libhttp_parser.so:www/http-parser
|
||||||
|
|
||||||
|
USES= cmake:testing compiler:c++17-lang localbase:ldflags ssl
|
||||||
USE_GITHUB= yes
|
USE_GITHUB= yes
|
||||||
GH_ACCOUNT= apigee
|
GH_ACCOUNT= apigee
|
||||||
GH_TAGNAME= 7e8dea9
|
|
||||||
|
|
||||||
USES= localbase ssl
|
PLIST_FILES= bin/apib bin/apibmon bin/testserver
|
||||||
GNU_CONFIGURE= yes
|
|
||||||
CONFIGURE_ENV= APR_LOC="${LOCALBASE}/include/apr-1"
|
|
||||||
|
|
||||||
PLIST_FILES= bin/apib bin/apibmon
|
|
||||||
PORTEXAMPLES= env.sh pivot run.sh rungroup.sh tojson
|
PORTEXAMPLES= env.sh pivot run.sh rungroup.sh tojson
|
||||||
|
|
||||||
OPTIONS_DEFINE= EXAMPLES
|
OPTIONS_DEFINE= EXAMPLES
|
||||||
|
|
||||||
post-patch:
|
post-install-EXAMPLES-on:
|
||||||
@${REINPLACE_CMD} -e 's, LIBS="-lssl,& -lcrypto,' ${WRKSRC}/configure
|
|
||||||
|
|
||||||
do-install:
|
|
||||||
${INSTALL_PROGRAM} ${WRKSRC}/apib ${WRKSRC}/apibmon \
|
|
||||||
${STAGEDIR}${PREFIX}/bin
|
|
||||||
|
|
||||||
do-install-EXAMPLES-on:
|
|
||||||
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
|
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
|
||||||
${INSTALL_DATA} ${WRKSRC}/samplescripts/* ${STAGEDIR}${EXAMPLESDIR}
|
${INSTALL_DATA} ${WRKSRC}/samplescripts/* ${STAGEDIR}${EXAMPLESDIR}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
TIMESTAMP = 1503959917
|
TIMESTAMP = 1586927181
|
||||||
SHA256 (apigee-apib-1.0-7e8dea9_GH0.tar.gz) = d54d3abef0123071d349aff47b6bf7477ad45056c876a704e6693c894da3611e
|
SHA256 (apigee-apib-APIB_1_2_1_RC1_GH0.tar.gz) = 7f890b766cab013bf12189f1f9fc73611b3fc3f4d051d60a2e5932d46e118cc0
|
||||||
SIZE (apigee-apib-1.0-7e8dea9_GH0.tar.gz) = 77363
|
SIZE (apigee-apib-APIB_1_2_1_RC1_GH0.tar.gz) = 65136
|
||||||
|
|
30
benchmarks/apib/files/patch-CMakeLists.txt
Normal file
30
benchmarks/apib/files/patch-CMakeLists.txt
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
--- CMakeLists.txt.orig 2020-04-15 05:06:21 UTC
|
||||||
|
+++ CMakeLists.txt
|
||||||
|
@@ -1,25 +1,13 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
project(Forest)
|
||||||
|
-include(ExternalProject)
|
||||||
|
+#include(ExternalProject)
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
-set(CMAKE_CXX_STANDARD 11)
|
||||||
|
+set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_FLAGS -Wall)
|
||||||
|
|
||||||
|
-ExternalProject_Add(
|
||||||
|
- gtest
|
||||||
|
- PREFIX gtest
|
||||||
|
- URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz
|
||||||
|
- URL_HASH SHA256=9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb
|
||||||
|
- INSTALL_COMMAND ""
|
||||||
|
-)
|
||||||
|
-
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_SOURCE_DIR}
|
||||||
|
- ${CMAKE_BINARY_DIR}/gtest/src/gtest/googletest/include
|
||||||
|
-)
|
||||||
|
-link_directories(
|
||||||
|
- ${CMAKE_BINARY_DIR}/gtest/src/gtest-build/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if (DEFINED ENV{OPENSSL_INCLUDE_DIR})
|
28
benchmarks/apib/files/patch-apib_CMakeLists.txt
Normal file
28
benchmarks/apib/files/patch-apib_CMakeLists.txt
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
--- apib/CMakeLists.txt.orig 2020-04-15 05:06:21 UTC
|
||||||
|
+++ apib/CMakeLists.txt
|
||||||
|
@@ -22,7 +22,7 @@ target_link_libraries(common PUBLIC -lhttp_parser
|
||||||
|
|
||||||
|
add_library(
|
||||||
|
cpu OBJECT
|
||||||
|
- apib_cpu_generic.cc
|
||||||
|
+ apib_cpu_bsd.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(cpu PUBLIC common)
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ add_library(
|
||||||
|
socket.h
|
||||||
|
tlssocket.h
|
||||||
|
)
|
||||||
|
-target_link_libraries(io PUBLIC common base64 -lev -lssl.1.1 -lcrypto.1.1)
|
||||||
|
+target_link_libraries(io PUBLIC common base64 -lev -lpthread -lssl -lcrypto)
|
||||||
|
|
||||||
|
add_library(
|
||||||
|
mon_lib OBJECT
|
||||||
|
@@ -65,3 +65,7 @@ add_executable(
|
||||||
|
)
|
||||||
|
target_link_libraries(apibmon mon_lib io cpu common base64)
|
||||||
|
|
||||||
|
+install(TARGETS
|
||||||
|
+ apib apibmon
|
||||||
|
+ DESTINATION bin
|
||||||
|
+)
|
|
@ -1,103 +0,0 @@
|
||||||
--- src/apib_cpu.c.orig 2017-08-28 22:38:37 UTC
|
|
||||||
+++ src/apib_cpu.c
|
|
||||||
@@ -14,6 +14,11 @@
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
+#ifdef __FreeBSD__
|
|
||||||
+#include <sys/types.h>
|
|
||||||
+#include <sys/sysctl.h>
|
|
||||||
+#include <sys/times.h>
|
|
||||||
+#endif
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
@@ -35,6 +40,9 @@ static double TicksPerSecond;
|
|
||||||
* for hyperthreading, etc. */
|
|
||||||
int cpu_Count(apr_pool_t* pool)
|
|
||||||
{
|
|
||||||
+#ifdef _SC_NPROCESSORS_ONLN
|
|
||||||
+ return (int)sysconf(_SC_NPROCESSORS_ONLN);
|
|
||||||
+#else
|
|
||||||
apr_status_t s;
|
|
||||||
apr_file_t* f;
|
|
||||||
char buf[PROC_BUF_LEN];
|
|
||||||
@@ -66,10 +74,20 @@ int cpu_Count(apr_pool_t* pool)
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static int getTicks(CPUUsage* cpu, apr_pool_t* pool)
|
|
||||||
{
|
|
||||||
+#ifdef __FreeBSD__
|
|
||||||
+ struct tms ticks;
|
|
||||||
+
|
|
||||||
+ cpu->idle = times(&ticks);
|
|
||||||
+ if (cpu->idle == -1)
|
|
||||||
+ return 0;
|
|
||||||
+ cpu->nonIdle = ticks.tms_utime + ticks.tms_stime;
|
|
||||||
+ return 1;
|
|
||||||
+#else
|
|
||||||
apr_status_t s;
|
|
||||||
apr_file_t* proc;
|
|
||||||
char buf[PROC_BUF_LEN];
|
|
||||||
@@ -118,10 +136,12 @@ static int getTicks(CPUUsage* cpu, apr_pool_t* pool)
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
double cpu_GetMemoryUsage(apr_pool_t* pool)
|
|
||||||
{
|
|
||||||
+#ifdef __linux__
|
|
||||||
apr_status_t s;
|
|
||||||
apr_file_t* proc;
|
|
||||||
char buf[PROC_BUF_LEN];
|
|
||||||
@@ -138,12 +158,36 @@ double cpu_GetMemoryUsage(apr_pool_t* pool)
|
|
||||||
if (s != APR_SUCCESS) {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
long totalMem = 0;
|
|
||||||
long freeMem = 0;
|
|
||||||
long buffers = 0;
|
|
||||||
long cache = 0;
|
|
||||||
|
|
||||||
+#ifdef __FreeBSD__
|
|
||||||
+ /* We work with kilobytes to match Linux' /proc/meminfo. */
|
|
||||||
+ long pagesize = sysconf(_SC_PAGESIZE) / 1024;
|
|
||||||
+ totalMem = sysconf(_SC_PHYS_PAGES) * pagesize;
|
|
||||||
+
|
|
||||||
+ size_t len;
|
|
||||||
+
|
|
||||||
+ unsigned free;
|
|
||||||
+ len = sizeof(free);
|
|
||||||
+ sysctlbyname("vm.stats.vm.v_free_count", &free, &len, NULL, 0);
|
|
||||||
+ freeMem = free * pagesize;
|
|
||||||
+
|
|
||||||
+ /* `buffers' is of expected type (long), no need for another variable. */
|
|
||||||
+ len = sizeof(buffers);
|
|
||||||
+ sysctlbyname("vfs.bufspace", &buffers, &len, NULL, 0);
|
|
||||||
+ buffers /= 1024;
|
|
||||||
+
|
|
||||||
+ /* `cache' is based on number of inactive pages since r309017. */
|
|
||||||
+ unsigned inact;
|
|
||||||
+ len = sizeof(inact);
|
|
||||||
+ sysctlbyname("vm.stats.vm.v_inactive_count", &inact, &len, NULL, 0);
|
|
||||||
+ cache = inact * pagesize;
|
|
||||||
+#else
|
|
||||||
while (linep_NextLine(&line)) {
|
|
||||||
char* n = linep_NextToken(&line, " ");
|
|
||||||
char* v = linep_NextToken(&line, " ");
|
|
||||||
@@ -158,6 +202,7 @@ double cpu_GetMemoryUsage(apr_pool_t* pool)
|
|
||||||
cache = atol(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
if ((totalMem <= 0) || (freeMem <= 0)) {
|
|
||||||
return 0.0;
|
|
39
benchmarks/apib/files/patch-test_CMakeLists.txt
Normal file
39
benchmarks/apib/files/patch-test_CMakeLists.txt
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
--- test/CMakeLists.txt.orig 2020-04-15 05:06:21 UTC
|
||||||
|
+++ test/CMakeLists.txt
|
||||||
|
@@ -3,14 +3,14 @@ add_library(
|
||||||
|
test_server.cc
|
||||||
|
test_server.h
|
||||||
|
)
|
||||||
|
-target_link_libraries(testserver_lib PUBLIC common -lev -lssl.1.1 -lcrypto.1.1 -lhttp_parser)
|
||||||
|
+target_link_libraries(testserver_lib PUBLIC common -lev -lpthread -lssl -lcrypto -lhttp_parser)
|
||||||
|
|
||||||
|
add_library(
|
||||||
|
keygen_lib OBJECT
|
||||||
|
test_keygen.cc
|
||||||
|
test_keygen.h
|
||||||
|
)
|
||||||
|
-target_link_libraries(keygen_lib PUBLIC common -lssl.1.1 -lcrypto.1.1)
|
||||||
|
+target_link_libraries(keygen_lib PUBLIC common -lssl -lcrypto)
|
||||||
|
|
||||||
|
add_executable(
|
||||||
|
testserver
|
||||||
|
@@ -22,7 +22,6 @@ add_executable(
|
||||||
|
iotest
|
||||||
|
io_test.cc
|
||||||
|
)
|
||||||
|
-add_dependencies(iotest gtest)
|
||||||
|
target_link_libraries(iotest testserver_lib io cpu common base64 -lgtest)
|
||||||
|
add_test(iotest iotest)
|
||||||
|
|
||||||
|
@@ -30,6 +29,10 @@ add_executable(
|
||||||
|
tlstest
|
||||||
|
tls_test.cc
|
||||||
|
)
|
||||||
|
-add_dependencies(tlstest gtest)
|
||||||
|
target_link_libraries(tlstest testserver_lib io cpu common keygen_lib base64 -lgtest)
|
||||||
|
add_test(tlstest tlstest)
|
||||||
|
+
|
||||||
|
+install(TARGETS
|
||||||
|
+ testserver
|
||||||
|
+ DESTINATION bin
|
||||||
|
+)
|
|
@ -1,8 +1,6 @@
|
||||||
apib is a tool that makes it easy to test API servers. It is supported
|
apib is a tool that makes it easy to run performance tests of HTTP API
|
||||||
on Unix systems that include the Apache Portable Runtime and OpenSSL.
|
servers. It has most of the features of Apache Bench (ab), but is also
|
||||||
|
intended as a more modern replacement. In particular, it offers:
|
||||||
apib has most of the features of Apache Bench (ab), but is also intended
|
|
||||||
to be a more modern replacement. In particular, it offers:
|
|
||||||
|
|
||||||
- Proper HTTP 1.1 support including keep-alives and chunked encoding
|
- Proper HTTP 1.1 support including keep-alives and chunked encoding
|
||||||
- Ability to spawn multiple I/O threads to take advantage of multiple
|
- Ability to spawn multiple I/O threads to take advantage of multiple
|
||||||
|
@ -12,5 +10,6 @@ to be a more modern replacement. In particular, it offers:
|
||||||
- Support for OAuth 1.0 signatures
|
- Support for OAuth 1.0 signatures
|
||||||
- Ability to output results to a file so they may be automated
|
- Ability to output results to a file so they may be automated
|
||||||
- Remote CPU monitoring
|
- Remote CPU monitoring
|
||||||
|
- Simple command-line interface
|
||||||
|
|
||||||
WWW: https://github.com/apigee/apib
|
WWW: https://github.com/apigee/apib
|
||||||
|
|
Loading…
Add table
Reference in a new issue