diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-28 17:41:49 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-28 17:41:54 +0100 |
commit | 1e68e451b164492ca18b86b9e39c5bd39204238f (patch) | |
tree | e9b5e53c8eaf81a5b832ebd4c9f7b5dc1b3346c0 | |
parent | 22d522f6cd09e2c5f1678a0479be5dc19ca1eb15 (diff) |
Output build time after successful build
-rw-r--r-- | src/main.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index c9b1fe2..9e84521 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include <cstdio> #include <iostream> #include <unordered_set> +#include <chrono> #include "../include/FileUtil.hpp" #include "../include/Conf.hpp" #include "../include/Exec.hpp" @@ -8,6 +9,7 @@ using namespace std; using namespace sibs; +using namespace std::chrono; // TODO: Fail if multiple versions of the same dependency is used // as linking will fail because of multiple definitions of the same thing @@ -247,12 +249,15 @@ int buildProject(int argc, const char **argv) break; } + auto startTime = high_resolution_clock::now(); Result<bool> buildFileResult = ninja.build(sibsConfig, buildPath.c_str()); if(buildFileResult.isErr()) { cerr << "Failed to build ninja file: " << buildFileResult.getErrMsg() << endl; exit(7); } + auto elapsedTime = duration_cast<duration<double>>(high_resolution_clock::now() - startTime); + printf("Build finished in %fs\n", elapsedTime.count()); return 0; } |