Skip to content

Commit

Permalink
test tile
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate committed Jan 7, 2022
1 parent 5a67bd3 commit 0bc3187
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 05/00_time/01/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 17)

project(cpptest LANGUAGES CXX)

add_executable(cpptest main.cpp)
13 changes: 13 additions & 0 deletions 05/00_time/01/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <iostream>
#include <thread>
#include <chrono>

int main() {
auto t0 = std::chrono::steady_clock::now();
for (volatile int i = 0; i < 100000; i++);
auto t1 = std::chrono::steady_clock::now();
auto dt = t1 - t0;
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(dt).count();
std::cout << "time elapsed: " << ms << " ms" << std::endl;
return 0;
}
6 changes: 6 additions & 0 deletions 05/00_time/01/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

cmake -B build
cmake --build build
build/cpptest
7 changes: 7 additions & 0 deletions 05/00_time/02/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 17)

project(cpptest LANGUAGES CXX)

add_executable(cpptest main.cpp)
8 changes: 8 additions & 0 deletions 05/00_time/02/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>
#include <thread>
#include <chrono>

int main() {
std::this_thread::sleep_for(std::chrono::milliseconds(400));
return 0;
}
6 changes: 6 additions & 0 deletions 05/00_time/02/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

cmake -B build
cmake --build build
build/cpptest
Binary file modified 05/slides.pptx
Binary file not shown.

0 comments on commit 0bc3187

Please sign in to comment.