From 1922341e2aa1c8a9f578c33315c3a3842a437fd2 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Sun, 19 Dec 2010 17:29:17 +0100 Subject: New benchmarks directory --- CMakeLists.txt | 6 +++++- DefineOptions.cmake | 1 + benchmarks/CMakeLists.txt | 21 +++++++++++++++++++++ benchmarks/bench1.sh | 13 +++++++++++++ benchmarks/bench2.sh | 13 +++++++++++++ benchmarks/bench_scp.c | 31 +++++++++++++++++++++++++++++++ tests/bench1.sh | 13 ------------- tests/bench2.sh | 13 ------------- 8 files changed, 84 insertions(+), 27 deletions(-) create mode 100644 benchmarks/CMakeLists.txt create mode 100644 benchmarks/bench1.sh create mode 100755 benchmarks/bench2.sh create mode 100644 benchmarks/bench_scp.c delete mode 100644 tests/bench1.sh delete mode 100755 tests/bench2.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 380075d..d57317f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,10 @@ if (WITH_TESTING) add_subdirectory(tests) endif (WITH_TESTING) +if (WITH_BENCHMARKS) + add_subdirectory(benchmarks) +endif (WITH_BENCHMARKS) + message(STATUS "********************************************") message(STATUS "********** ${PROJECT_NAME} build options : **********") @@ -113,6 +117,6 @@ if (WITH_INTERNAL_DOC) else (WITH_INTERNAL_DOC) message(STATUS "Public API documentation generation") endif (WITH_INTERNAL_DOC) - +message(STATUS "Benchmarks: ${WITH_BENCHMARKS}") message(STATUS "********************************************") diff --git a/DefineOptions.cmake b/DefineOptions.cmake index 3d9dc64..17abbd1 100644 --- a/DefineOptions.cmake +++ b/DefineOptions.cmake @@ -10,6 +10,7 @@ option(WITH_PCAP "Compile with Pcap generation support" ON) option(WITH_INTERNAL_DOC "Compile doxygen internal documentation" OFF) option(WITH_TESTING "Build with unit tests" OFF) option(WITH_CLIENT_TESTING "Build with client tests; requires a running sshd" OFF) +option(WITH_BENCHMARKS "Build benchmarks tools" OFF) if (WITH_TESTING) set(WITH_STATIC_LIB ON) endif (WITH_TESTING) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt new file mode 100644 index 0000000..eb84393 --- /dev/null +++ b/benchmarks/CMakeLists.txt @@ -0,0 +1,21 @@ +project(libssh-benchmarks C) + +set(benchmarks_SRCS + +) + +include_directories( + ${LIBSSH_PUBLIC_INCLUDE_DIRS} +) + +add_executable(bench_scp bench_scp.c ${benchmarks_SRCS}) + +target_link_libraries(bench_scp ${LIBSSH_SHARED_LIBRARY}) + +include_directories( + ${LIBSSH_PUBLIC_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} +) + +if (WITH_SFTP) +endif (WITH_SFTP) diff --git a/benchmarks/bench1.sh b/benchmarks/bench1.sh new file mode 100644 index 0000000..4458e9a --- /dev/null +++ b/benchmarks/bench1.sh @@ -0,0 +1,13 @@ +export CIPHER=aes128-cbc +export DEST=localhost + +echo "Upload raw SSH statistics" +echo "local machine: `uname -a`" +echo "Cipher : $CIPHER ; Destination : $DEST (`ssh $DEST uname -a`)" +echo "Local ssh version: `ssh -V 2>&1`" +echo "Ping latency to $DEST": +ping -q -c 1 -n $DEST +echo "Destination $DEST SSHD vesion : `echo | nc $DEST 22 | head -n1`" +echo "ssh login latency :`(time -f user:%U ssh $DEST 'id > /dev/null') 2>&1`" +./generate.py | dd bs=4096 count=100000 | time ssh -c $CIPHER $DEST "dd bs=4096 of=/dev/null" 2>&1 + diff --git a/benchmarks/bench2.sh b/benchmarks/bench2.sh new file mode 100755 index 0000000..01d6777 --- /dev/null +++ b/benchmarks/bench2.sh @@ -0,0 +1,13 @@ +export CIPHER=aes128-cbc +export DEST=localhost + +echo "Upload raw SSH statistics" +echo "local machine: `uname -a`" +echo "Cipher : $CIPHER ; Destination : $DEST (`ssh $DEST uname -a`)" +echo "Local ssh version: `samplessh -V 2>&1`" +echo "Ping latency to $DEST": +ping -q -c 1 -n $DEST +echo "Destination $DEST SSHD vesion : `echo | nc $DEST 22 | head -n1`" +echo "ssh login latency :`(time -f user:%U samplessh $DEST 'id > /dev/null') 2>&1`" +./generate.py | dd bs=4096 count=100000 | strace samplessh -c $CIPHER $DEST "dd bs=4096 of=/dev/null" 2>&1 + diff --git a/benchmarks/bench_scp.c b/benchmarks/bench_scp.c new file mode 100644 index 0000000..7406287 --- /dev/null +++ b/benchmarks/bench_scp.c @@ -0,0 +1,31 @@ +/* bench_scp.c + * + * This file is part of the SSH Library + * + * Copyright (c) 2010 by Aris Adamantiadis + * + * The SSH Library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * The SSH Library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the SSH Library; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include +#include + +int main(int argc, char **argv){ + (void) argc; + (void) argv; + printf("bench_scp\n"); + return 0; +} diff --git a/tests/bench1.sh b/tests/bench1.sh deleted file mode 100644 index 4458e9a..0000000 --- a/tests/bench1.sh +++ /dev/null @@ -1,13 +0,0 @@ -export CIPHER=aes128-cbc -export DEST=localhost - -echo "Upload raw SSH statistics" -echo "local machine: `uname -a`" -echo "Cipher : $CIPHER ; Destination : $DEST (`ssh $DEST uname -a`)" -echo "Local ssh version: `ssh -V 2>&1`" -echo "Ping latency to $DEST": -ping -q -c 1 -n $DEST -echo "Destination $DEST SSHD vesion : `echo | nc $DEST 22 | head -n1`" -echo "ssh login latency :`(time -f user:%U ssh $DEST 'id > /dev/null') 2>&1`" -./generate.py | dd bs=4096 count=100000 | time ssh -c $CIPHER $DEST "dd bs=4096 of=/dev/null" 2>&1 - diff --git a/tests/bench2.sh b/tests/bench2.sh deleted file mode 100755 index 01d6777..0000000 --- a/tests/bench2.sh +++ /dev/null @@ -1,13 +0,0 @@ -export CIPHER=aes128-cbc -export DEST=localhost - -echo "Upload raw SSH statistics" -echo "local machine: `uname -a`" -echo "Cipher : $CIPHER ; Destination : $DEST (`ssh $DEST uname -a`)" -echo "Local ssh version: `samplessh -V 2>&1`" -echo "Ping latency to $DEST": -ping -q -c 1 -n $DEST -echo "Destination $DEST SSHD vesion : `echo | nc $DEST 22 | head -n1`" -echo "ssh login latency :`(time -f user:%U samplessh $DEST 'id > /dev/null') 2>&1`" -./generate.py | dd bs=4096 count=100000 | strace samplessh -c $CIPHER $DEST "dd bs=4096 of=/dev/null" 2>&1 - -- cgit