File tree 9 files changed +35
-23
lines changed
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 7
7
namespace codspeed {
8
8
9
9
class CodSpeed {
10
- public:
10
+ public:
11
11
// Public static method to access the single instance
12
12
static CodSpeed *getInstance () {
13
13
static CodSpeed instance;
@@ -20,7 +20,7 @@ class CodSpeed {
20
20
void start_benchmark (const std::string &name);
21
21
void end_benchmark ();
22
22
23
- private:
23
+ private:
24
24
// Private constructor to prevent direct instantiation
25
25
CodSpeed ();
26
26
std::vector<std::string> benchmarked;
@@ -50,6 +50,6 @@ std::string sanitize_bench_args(std::string &text);
50
50
// an argument
51
51
std::string get_path_relative_to_workspace (const std::string &path);
52
52
53
- } // namespace codspeed
53
+ } // namespace codspeed
54
54
55
- #endif // CODSPEED_H
55
+ #endif // CODSPEED_H
Original file line number Diff line number Diff line change 1
- #include " measurement.hpp"
2
1
#include < codspeed.h>
2
+
3
3
#include < iostream>
4
4
#include < string>
5
5
#include < vector>
6
6
7
+ #include " measurement.hpp"
8
+
7
9
namespace codspeed {
8
10
// Remove any `::` between brackets at the end to not mess with the URI
9
11
// parsing
@@ -93,4 +95,4 @@ void CodSpeed::end_benchmark() {
93
95
<< std::endl;
94
96
}
95
97
96
- } // namespace codspeed
98
+ } // namespace codspeed
Original file line number Diff line number Diff line change 1
1
#ifndef MEASUREMENT_H
2
2
#define MEASUREMENT_H
3
3
4
- #include " callgrind.h"
5
4
#include < string>
6
5
6
+ #include " callgrind.h"
7
+
7
8
inline std::string get_version () {
8
9
#ifdef CODSPEED_VERSION
9
10
return {CODSPEED_VERSION};
@@ -29,4 +30,4 @@ inline void measurement_stop(const std::string &name) {
29
30
CALLGRIND_DUMP_STATS_AT (name.c_str ());
30
31
};
31
32
32
- #endif // MEASUREMENT_H
33
+ #endif // MEASUREMENT_H
Original file line number Diff line number Diff line change 1
- #include " codspeed.h"
2
1
#include < iostream>
3
2
#include < string>
4
3
4
+ #include " codspeed.h"
5
+
5
6
namespace codspeed {
6
7
7
8
// Example: auto outer::test12::(anonymous class)::operator()() const
@@ -13,7 +14,7 @@ std::string extract_namespace_clang(const std::string &pretty_func) {
13
14
if (space_pos == std::string::npos || anon_class_pos == std::string::npos) {
14
15
return {};
15
16
}
16
- space_pos += 1 ; // Skip the space
17
+ space_pos += 1 ; // Skip the space
17
18
18
19
return pretty_func.substr (space_pos, anon_class_pos - space_pos) + " ::" ;
19
20
}
@@ -50,4 +51,4 @@ std::string extract_lambda_namespace(const std::string &pretty_func) {
50
51
#endif
51
52
}
52
53
53
- } // namespace codspeed
54
+ } // namespace codspeed
Original file line number Diff line number Diff line change 1
- #include " codspeed.h"
2
1
#include < algorithm>
3
2
#include < cmath>
4
3
#include < cstdlib>
8
7
#include < numeric>
9
8
#include < sstream>
10
9
#include < string>
10
+
11
+ #include " codspeed.h"
11
12
#ifdef _WIN32
12
13
#include < process.h>
13
14
#else
@@ -49,8 +50,7 @@ struct CodspeedWalltimeBenchmark {
49
50
50
51
double compute_quantile (const std::vector<double > &data, double quantile) {
51
52
size_t n = data.size ();
52
- if (n == 0 )
53
- return 0.0 ;
53
+ if (n == 0 ) return 0.0 ;
54
54
55
55
double pos = quantile * (n - 1 );
56
56
size_t k = static_cast <size_t >(pos);
@@ -237,7 +237,7 @@ void generate_codspeed_walltime_report(
237
237
iqr_outlier_rounds,
238
238
stdev_outlier_rounds,
239
239
raw_benchmark.iter_per_round ,
240
- 0 // TODO: warmup_iters
240
+ 0 // TODO: warmup_iters
241
241
};
242
242
243
243
codspeed_walltime_benchmarks.push_back (codspeed_benchmark);
@@ -246,4 +246,4 @@ void generate_codspeed_walltime_report(
246
246
write_codspeed_benchmarks_to_json (codspeed_walltime_benchmarks);
247
247
}
248
248
249
- } // namespace codspeed
249
+ } // namespace codspeed
Original file line number Diff line number Diff line change 1
1
// Implementation
2
- #include " codspeed.h"
3
2
#include < cstdlib>
4
3
#include < filesystem>
5
4
5
+ #include " codspeed.h"
6
+
6
7
namespace codspeed {
7
8
8
9
std::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) {
22
23
.string ();
23
24
}
24
25
25
- } // namespace codspeed
26
+ } // namespace codspeed
Original file line number Diff line number Diff line change 1
1
#include " codspeed.h"
2
+
2
3
#include < gtest/gtest.h>
3
4
4
5
// Manual definition (to avoid including it in the public header):
Original file line number Diff line number Diff line change 1
- #include " codspeed.h"
2
1
#include < gtest/gtest.h>
3
2
3
+ #include " codspeed.h"
4
+
4
5
// Manual definition (to avoid including it in the public header):
5
6
namespace codspeed {
6
7
std::string extract_namespace_clang (const std::string &func_str);
7
8
std::string extract_namespace_gcc (const std::string &func_str);
8
- } // namespace codspeed
9
+ } // namespace codspeed
9
10
10
11
TEST (UriTest, TestExtractNamespaceClang) {
11
12
EXPECT_EQ (codspeed::extract_namespace_clang (
@@ -33,6 +34,6 @@ static std::string pretty_func = ([]() { return __PRETTY_FUNCTION__; })();
33
34
TEST (UriTest, TestExtractNamespace) {
34
35
EXPECT_EQ (codspeed::extract_lambda_namespace (pretty_func), " a::b::c::" );
35
36
}
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