summaryrefslogtreecommitdiff
path: root/src/tools/operf
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/operf')
-rw-r--r--src/tools/operf/CMakeLists.txt26
-rw-r--r--src/tools/operf/operf.c7
-rw-r--r--src/tools/operf/operf_client.c12
-rw-r--r--src/tools/operf/operf_server.c8
4 files changed, 13 insertions, 40 deletions
diff --git a/src/tools/operf/CMakeLists.txt b/src/tools/operf/CMakeLists.txt
deleted file mode 100644
index b6faf04e..00000000
--- a/src/tools/operf/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-include_directories(${CMAKE_SOURCE_DIR}/include)
-include_directories(${CMAKE_BINARY_DIR}/include)
-
-get_filename_component(CURRENT_SOURCE_PARENT_DIR
- ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
-
-include_directories(${CURRENT_SOURCE_PARENT_DIR})
-
-find_library(LIBM_LIBRARIES m)
-if(NOT LIBM_LIBRARIES)
- message(FATAL_ERROR "libm not found")
-endif()
-
-set(SOURCE_FILES
- # Add source files here
- operf.c
- )
-
-add_executable(operf ${SOURCE_FILES})
-
-target_link_libraries(operf LINK_PUBLIC ${LIBM_LIBRARIES} ouroboros-dev)
-
-install(TARGETS operf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/src/tools/operf/operf.c b/src/tools/operf/operf.c
index ed07323c..3263d3bf 100644
--- a/src/tools/operf/operf.c
+++ b/src/tools/operf/operf.c
@@ -1,10 +1,10 @@
/*
- * Ouroboros - Copyright (C) 2016 - 2020
+ * Ouroboros - Copyright (C) 2016 - 2024
*
* Ouroboros perf application
*
- * Dimitri Staessens <dimitri.staessens@ugent.be>
- * Sander Vrijders <sander.vrijders@ugent.be>
+ * Dimitri Staessens <dimitri@ouroboros.rocks>
+ * Sander Vrijders <sander@ouroboros.rocks>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -54,7 +54,6 @@
#include <stdlib.h>
#include <sys/time.h>
#include <arpa/inet.h>
-#include <math.h>
#include <errno.h>
#include <float.h>
diff --git a/src/tools/operf/operf_client.c b/src/tools/operf/operf_client.c
index 004a8965..7060ce5b 100644
--- a/src/tools/operf/operf_client.c
+++ b/src/tools/operf/operf_client.c
@@ -1,10 +1,10 @@
/*
- * Ouroboros - Copyright (C) 2016 - 2020
+ * Ouroboros - Copyright (C) 2016 - 2024
*
* Ouroboros ping application
*
- * Dimitri Staessens <dimitri.staessens@ugent.be>
- * Sander Vrijders <sander.vrijders@ugent.be>
+ * Dimitri Staessens <dimitri@ouroboros.rocks>
+ * Sander Vrijders <sander@ouroboros.rocks>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -133,7 +133,7 @@ void * writer(void * o)
clock_gettime(CLOCK_REALTIME, &start);
clock_gettime(CLOCK_REALTIME, &now);
- while (!stop && ts_diff_ms(&start, &now) < client.duration) {
+ while (!stop && ts_diff_ms(&now, &start) > client.duration) {
if (!client.flood) {
clock_gettime(CLOCK_REALTIME, &now);
ts_add(&now, &intv, &end);
@@ -230,10 +230,10 @@ int client_main(void)
printf("%ld received, ", client.rcvd);
printf("%ld%% packet loss, ", client.sent == 0 ? 0 :
100 - ((100 * client.rcvd) / client.sent));
- printf("time: %.3f ms, ", ts_diff_us(&tic, &toc) / 1000.0);
+ printf("time: %.3f ms, ", ts_diff_us(&toc, &tic) / 1000.0);
printf("bandwidth: %.3lf Mb/s.\n",
(client.rcvd * client.size * 8)
- / (double) ts_diff_us(&tic, &toc));
+ / (double) ts_diff_us(&toc, &tic));
}
flow_dealloc(fd);
diff --git a/src/tools/operf/operf_server.c b/src/tools/operf/operf_server.c
index f3ca8b19..a611f79c 100644
--- a/src/tools/operf/operf_server.c
+++ b/src/tools/operf/operf_server.c
@@ -1,10 +1,10 @@
/*
- * Ouroboros - Copyright (C) 2016 - 2020
+ * Ouroboros - Copyright (C) 2016 - 2024
*
* Ouroboros perf application
*
- * Dimitri Staessens <dimitri.staessens@ugent.be>
- * Sander Vrijders <sander.vrijders@ugent.be>
+ * Dimitri Staessens <dimitri@ouroboros.rocks>
+ * Sander Vrijders <sander@ouroboros.rocks>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -66,7 +66,7 @@ void * cleaner_thread(void * o)
pthread_mutex_lock(&server.lock);
for (i = 0; i < OPERF_MAX_FLOWS; ++i)
if (fset_has(server.flows, i) &&
- ts_diff_ms(&server.times[i], &now)
+ ts_diff_ms(&now, &server.times[i])
> server.timeout) {
printf("Flow %d timed out.\n", i);
fset_del(server.flows, i);