mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-11 13:35:03 -04:00
Prepare a benchmark program
This commit is contained in:
parent
a6ef114dca
commit
f0f0508910
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
include ../cpp.mk
|
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
|
default: dist
|
||||||
|
|
||||||
|
14
programs/bench/Makefile
Normal file
14
programs/bench/Makefile
Normal file
@ -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
|
31
programs/bench/src/main.cpp
Normal file
31
programs/bench/src/main.cpp
Normal file
@ -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 <print.hpp>
|
||||||
|
#include <system.hpp>
|
||||||
|
#include <datetime.hpp>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user