gcc $(CFLAGS) -o benchmark/p2p-gdbus $(DFTSRC) benchmark/p2p-gdbus.c $(LDFLAGS)
gcc $(CFLAGS) -o benchmark/libdbus $(DFTSRC) benchmark/libdbus.c $(LDFLAGS)
-libdbus-p2p-client: benchmark/libdbus-p2p-client.cpp
+libdbus-p2p-client: benchmark/libdbus-p2p-client.cpp benchmark/common.c
$(CXX) $(CXXFLAGS) $^ $(LDLIBS) -o benchmark/$@
libdbus-p2p-server: benchmark/libdbus-p2p-server.cpp
$(CXX) $(CXXFLAGS) $^ $(LDLIBS) -o benchmark/$@
-libdbus-p2p-common: benchmark/libdbus-p2p-common.cpp benchmark/libdbus-p2p-client.cpp benchmark/libdbus-p2p-server.cpp
+libdbus-p2p-common: benchmark/libdbus-p2p-common.cpp benchmark/libdbus-p2p-client.cpp benchmark/libdbus-p2p-server.cpp benchmark/common.c
$(CXX) $(CXXFLAGS) -DLIBDBUS_P2P_COMMON $^ $(LDLIBS) -o benchmark/$@
install:
printf("-r: raw data mode (store every possible latency measurement in a csv file)\n");
printf("-h: print help page\n");
}
+
+void fill_string_with_offset(size_t size, char *str, size_t offset)
+{
+ /* Fills a string with some predictable garbage. This is so
+ * that strings change depending on the offset so as to minimize
+ * the possibility of caching etc., but is done using a trivial
+ * pattern for easier debugging. */
+
+ for (size_t i = 0; i < size - 1; ++i)
+ str[i] = '!' + (i + offset) % ('~' - '!' + 1);
+ str[size - 1] = '\0';
+}
#include <fcntl.h>
#include <time.h>
#include <string.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#define ONE_PAGE_SIZE 4096
-typedef enum {false, true} bool;
void print_help(char **argv);
int cpu_pin(int cpuid, int pid);
+void fill_string_with_offset(size_t size, char *str, size_t offset);
#endif
for(int i = 0; i < WARMUP_TRY + n_real_tries; i++) {
struct timespec clock;
- memset(cptr, 0, size);
+ fill_string_with_offset(size, cptr, i);
+
if(i >= WARMUP_TRY)
cptr[0] = 'r';
else
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. */
+#include "common.h"
+
#include <dbus/dbus.h>
#include <unistd.h>
auto message = new char [opt.payload];
for (size_t i = 0; i < opt.try_count; ++i) {
+ fill_string_with_offset (opt.payload, message, i);
+
auto * const msg = dbus_message_new_method_call
( TEST_NAME
, TEST_PATH
for(int i = 0; i < WARMUP_TRY + n_real_tries; i++) {
struct timespec clock;
- memset(cptr, 0, size);
+ fill_string_with_offset(size, cptr, i);
+
if(i >= WARMUP_TRY)
cptr[0] = 'r';
else
GError *error = NULL;
register char *cptr = malloc(size);
unsigned long long start;
- int i, j;
+ int i;
char dbus_test_svc_name[strlen(DBUS_TEST_SVC_NAME) + strlen(number) + 1];
strncpy(&dbus_test_svc_name[0], DBUS_TEST_SVC_NAME, strlen(DBUS_TEST_SVC_NAME)+1);
sleep(2);
for (i = 0; i < WARMUP_TRY + n_real_tries; ++i) {
- for (j = 0; j < size-1; ++j)
- cptr[j] = '!' + (j + i) % ('~' - '!' + 1);
- cptr[size-1] = '\0';
+ fill_string_with_offset(size, cptr, i);
if (i >= WARMUP_TRY)
cptr[0] = 'R';
int wres1, wres2;
struct timespec clock;
- memset(cptr, 0, size);
+ fill_string_with_offset(size, cptr, i);
+
if(i >= WARMUP_TRY)
cptr[0] = 'r';
else
goto repeat;
}
- memset(cptr, 0, size);
+ fill_string_with_offset(size, cptr, i);
+
if(i >= WARMUP_TRY)
cptr[0] = 'r';
else
int wres1, wres2;
struct timespec clock;
- memset(cptr, 0, size);
+ fill_string_with_offset(size, cptr, i);
+
if(i >= WARMUP_TRY)
cptr[0] = 'r';
else