Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
d17ea665
Unverified
Commit
d17ea665
authored
Jun 03, 2021
by
Dominic Hamon
Committed by
GitHub
Jun 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix leak in test, and provide path to remove leak from library (#1169)
* Fix leak in test, and provide path to remove leak from library * make doc change
parent
32cc6071
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
0 deletions
+10
-0
README.md
README.md
+1
-0
benchmark.h
include/benchmark/benchmark.h
+3
-0
benchmark.cc
src/benchmark.cc
+4
-0
benchmark_gtest.cc
test/benchmark_gtest.cc
+2
-0
No files found.
README.md
View file @
d17ea665
...
...
@@ -1243,6 +1243,7 @@ int main(int argc, char** argv) {
benchmark
::
RegisterBenchmark
(
test_input
.
name
(),
BM_test
,
test_input
);
benchmark
::
Initialize
(
&
argc
,
argv
);
benchmark
::
RunSpecifiedBenchmarks
();
benchmark
::
Shutdown
();
}
```
...
...
include/benchmark/benchmark.h
View file @
d17ea665
...
...
@@ -42,6 +42,7 @@ BENCHMARK(BM_StringCopy);
int main(int argc, char** argv) {
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
benchmark::Shutdown();
return 0;
}
...
...
@@ -274,6 +275,7 @@ class BenchmarkReporter;
class
MemoryManager
;
void
Initialize
(
int
*
argc
,
char
**
argv
);
void
Shutdown
();
// Report to stdout all arguments in 'argv' as unrecognized except the first.
// Returns true there is at least on unrecognized argument (i.e. 'argc' > 1).
...
...
@@ -1314,6 +1316,7 @@ class Fixture : public internal::Benchmark {
::benchmark::Initialize(&argc, argv); \
if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; \
::benchmark::RunSpecifiedBenchmarks(); \
::benchmark::Shutdown(); \
return 0; \
} \
int main(int, char**)
...
...
src/benchmark.cc
View file @
d17ea665
...
...
@@ -548,6 +548,10 @@ void Initialize(int* argc, char** argv) {
internal
::
LogLevel
()
=
FLAGS_v
;
}
void
Shutdown
()
{
delete
internal
::
global_context
;
}
bool
ReportUnrecognizedArguments
(
int
argc
,
char
**
argv
)
{
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
fprintf
(
stderr
,
"%s: error: unrecognized command-line flag: %s
\n
"
,
argv
[
0
],
...
...
test/benchmark_gtest.cc
View file @
d17ea665
...
...
@@ -143,6 +143,7 @@ TEST(AddCustomContext, Simple) {
testing
::
UnorderedElementsAre
(
testing
::
Pair
(
"foo"
,
"bar"
),
testing
::
Pair
(
"baz"
,
"qux"
)));
delete
global_context
;
global_context
=
nullptr
;
}
...
...
@@ -155,6 +156,7 @@ TEST(AddCustomContext, DuplicateKey) {
EXPECT_THAT
(
*
global_context
,
testing
::
UnorderedElementsAre
(
testing
::
Pair
(
"foo"
,
"bar"
)));
delete
global_context
;
global_context
=
nullptr
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment