diff --git a/programs/Makefile b/programs/Makefile index f028477b..79042405 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -2,7 +2,7 @@ include ../cpp.mk -PROGRAMS=long loop longone longtwo keyboard tsh cpuid shutdown reboot args stat cat which readelf touch mkdir rm date ls lspci lse820 mount df uptime writer divzero odin ps +PROGRAMS=long loop longone longtwo keyboard tsh cpuid shutdown reboot args stat cat which readelf touch mkdir rm date ls lspci lse820 mount df uptime writer divzero odin ps bench default: dist diff --git a/programs/bench/Makefile b/programs/bench/Makefile new file mode 100644 index 00000000..6ce33876 --- /dev/null +++ b/programs/bench/Makefile @@ -0,0 +1,14 @@ +.PHONY: default clean + +EXEC_NAME=bench + +default: link + +include ../../cpp.mk + +$(eval $(call program_compile_cpp_folder,src)) +$(eval $(call program_link_executable,$(EXEC_NAME))) + +clean: + @ echo -e "Remove compiled files" + @ rm -rf debug diff --git a/programs/bench/src/main.cpp b/programs/bench/src/main.cpp new file mode 100644 index 00000000..5843ac22 --- /dev/null +++ b/programs/bench/src/main.cpp @@ -0,0 +1,31 @@ +//======================================================================= +// Copyright Baptiste Wicht 2013-2016. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= + +#include +#include +#include + +constexpr const size_t PAGES = 256; + +//TODO Need a ms timestamp at least + +int main(){ + char* buffer_one = new char[PAGES * 4096]; + char* buffer_two = new char[PAGES * 4096]; + + auto date = local_date(); + auto start = date.hour * 3600 + date.minutes * 60 + date.seconds; + + std::copy_n(buffer_one, buffer_two, PAGES * 4096); + + date = local_date(); + auto end = date.hour * 3600 + date.minutes * 60 + date.seconds; + + printf("Copy took %u \n", end - start); + + exit(0); +}