File tree Expand file tree Collapse file tree 9 files changed +35
-23
lines changed
Expand file tree Collapse file tree 9 files changed +35
-23
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ Language : Cpp
3+ BasedOnStyle : Google
4+ PointerAlignment : Left
5+ ...
Original file line number Diff line number Diff line change 77namespace codspeed {
88
99class CodSpeed {
10- public:
10+ public:
1111 // Public static method to access the single instance
1212 static CodSpeed *getInstance () {
1313 static CodSpeed instance;
@@ -20,7 +20,7 @@ class CodSpeed {
2020 void start_benchmark (const std::string &name);
2121 void end_benchmark ();
2222
23- private:
23+ private:
2424 // Private constructor to prevent direct instantiation
2525 CodSpeed ();
2626 std::vector<std::string> benchmarked;
@@ -50,6 +50,6 @@ std::string sanitize_bench_args(std::string &text);
5050// an argument
5151std::string get_path_relative_to_workspace (const std::string &path);
5252
53- } // namespace codspeed
53+ } // namespace codspeed
5454
55- #endif // CODSPEED_H
55+ #endif // CODSPEED_H
Original file line number Diff line number Diff line change 1- #include " measurement.hpp"
21#include < codspeed.h>
2+
33#include < iostream>
44#include < string>
55#include < vector>
66
7+ #include " measurement.hpp"
8+
79namespace codspeed {
810// Remove any `::` between brackets at the end to not mess with the URI
911// parsing
@@ -93,4 +95,4 @@ void CodSpeed::end_benchmark() {
9395 << std::endl;
9496}
9597
96- } // namespace codspeed
98+ } // namespace codspeed
Original file line number Diff line number Diff line change 11#ifndef MEASUREMENT_H
22#define MEASUREMENT_H
33
4- #include " callgrind.h"
54#include < string>
65
6+ #include " callgrind.h"
7+
78inline std::string get_version () {
89#ifdef CODSPEED_VERSION
910 return {CODSPEED_VERSION};
@@ -29,4 +30,4 @@ inline void measurement_stop(const std::string &name) {
2930 CALLGRIND_DUMP_STATS_AT (name.c_str ());
3031};
3132
32- #endif // MEASUREMENT_H
33+ #endif // MEASUREMENT_H
Original file line number Diff line number Diff line change 1- #include " codspeed.h"
21#include < iostream>
32#include < string>
43
4+ #include " codspeed.h"
5+
56namespace codspeed {
67
78// Example: auto outer::test12::(anonymous class)::operator()() const
@@ -13,7 +14,7 @@ std::string extract_namespace_clang(const std::string &pretty_func) {
1314 if (space_pos == std::string::npos || anon_class_pos == std::string::npos) {
1415 return {};
1516 }
16- space_pos += 1 ; // Skip the space
17+ space_pos += 1 ; // Skip the space
1718
1819 return pretty_func.substr (space_pos, anon_class_pos - space_pos) + " ::" ;
1920}
@@ -50,4 +51,4 @@ std::string extract_lambda_namespace(const std::string &pretty_func) {
5051#endif
5152}
5253
53- } // namespace codspeed
54+ } // namespace codspeed
Original file line number Diff line number Diff line change 1- #include " codspeed.h"
21#include < algorithm>
32#include < cmath>
43#include < cstdlib>
87#include < numeric>
98#include < sstream>
109#include < string>
10+
11+ #include " codspeed.h"
1112#ifdef _WIN32
1213#include < process.h>
1314#else
@@ -49,8 +50,7 @@ struct CodspeedWalltimeBenchmark {
4950
5051double compute_quantile (const std::vector<double > &data, double quantile) {
5152 size_t n = data.size ();
52- if (n == 0 )
53- return 0.0 ;
53+ if (n == 0 ) return 0.0 ;
5454
5555 double pos = quantile * (n - 1 );
5656 size_t k = static_cast <size_t >(pos);
@@ -237,7 +237,7 @@ void generate_codspeed_walltime_report(
237237 iqr_outlier_rounds,
238238 stdev_outlier_rounds,
239239 raw_benchmark.iter_per_round ,
240- 0 // TODO: warmup_iters
240+ 0 // TODO: warmup_iters
241241 };
242242
243243 codspeed_walltime_benchmarks.push_back (codspeed_benchmark);
@@ -246,4 +246,4 @@ void generate_codspeed_walltime_report(
246246 write_codspeed_benchmarks_to_json (codspeed_walltime_benchmarks);
247247}
248248
249- } // namespace codspeed
249+ } // namespace codspeed
Original file line number Diff line number Diff line change 11// Implementation
2- #include " codspeed.h"
32#include < cstdlib>
43#include < filesystem>
54
5+ #include " codspeed.h"
6+
67namespace codspeed {
78
89std::string get_path_relative_to_workspace (const std::string &path) {
@@ -22,4 +23,4 @@ std::string get_path_relative_to_workspace(const std::string &path) {
2223 .string ();
2324}
2425
25- } // namespace codspeed
26+ } // namespace codspeed
Original file line number Diff line number Diff line change 11#include " codspeed.h"
2+
23#include < gtest/gtest.h>
34
45// Manual definition (to avoid including it in the public header):
Original file line number Diff line number Diff line change 1- #include " codspeed.h"
21#include < gtest/gtest.h>
32
3+ #include " codspeed.h"
4+
45// Manual definition (to avoid including it in the public header):
56namespace codspeed {
67std::string extract_namespace_clang (const std::string &func_str);
78std::string extract_namespace_gcc (const std::string &func_str);
8- } // namespace codspeed
9+ } // namespace codspeed
910
1011TEST (UriTest, TestExtractNamespaceClang) {
1112 EXPECT_EQ (codspeed::extract_namespace_clang (
@@ -33,6 +34,6 @@ static std::string pretty_func = ([]() { return __PRETTY_FUNCTION__; })();
3334TEST (UriTest, TestExtractNamespace) {
3435 EXPECT_EQ (codspeed::extract_lambda_namespace (pretty_func), " a::b::c::" );
3536}
36- } // namespace c
37- } // namespace b
38- } // namespace a
37+ } // namespace c
38+ } // namespace b
39+ } // namespace a
You can’t perform that action at this time.
0 commit comments