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
3c83ed5b
Commit
3c83ed5b
authored
Oct 12, 2015
by
Dominic Hamon
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #149 from DiracResearch/android-fix
Android fix
parents
f7022075
8c71c307
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
10 deletions
+24
-10
commandlineflags.cc
src/commandlineflags.cc
+1
-0
string_util.cc
src/string_util.cc
+5
-2
sysinfo.cc
src/sysinfo.cc
+3
-1
benchmark_test.cc
test/benchmark_test.cc
+1
-0
filter_test.cc
test/filter_test.cc
+14
-7
No files found.
src/commandlineflags.cc
View file @
3c83ed5b
...
...
@@ -14,6 +14,7 @@
#include "commandlineflags.h"
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <limits>
...
...
src/string_util.cc
View file @
3c83ed5b
...
...
@@ -5,6 +5,7 @@
#include <array>
#include <memory>
#include <sstream>
#include <stdio.h>
#include "arraysize.h"
...
...
@@ -127,7 +128,8 @@ std::string StringPrintFImp(const char *msg, va_list args)
// allocation guess what the size might be
std
::
array
<
char
,
256
>
local_buff
;
std
::
size_t
size
=
local_buff
.
size
();
auto
ret
=
std
::
vsnprintf
(
local_buff
.
data
(),
size
,
msg
,
args_cp
);
// 2015-10-08: vsnprintf is used instead of snd::vsnprintf due to a limitation in the android-ndk
auto
ret
=
vsnprintf
(
local_buff
.
data
(),
size
,
msg
,
args_cp
);
va_end
(
args_cp
);
...
...
@@ -141,7 +143,8 @@ std::string StringPrintFImp(const char *msg, va_list args)
// add 1 to size to account for null-byte in size cast to prevent overflow
size
=
static_cast
<
std
::
size_t
>
(
ret
)
+
1
;
auto
buff_ptr
=
std
::
unique_ptr
<
char
[]
>
(
new
char
[
size
]);
ret
=
std
::
vsnprintf
(
buff_ptr
.
get
(),
size
,
msg
,
args
);
// 2015-10-08: vsnprintf is used instead of snd::vsnprintf due to a limitation in the android-ndk
ret
=
vsnprintf
(
buff_ptr
.
get
(),
size
,
msg
,
args
);
return
std
::
string
(
buff_ptr
.
get
());
}
...
...
src/sysinfo.cc
View file @
3c83ed5b
...
...
@@ -23,9 +23,11 @@
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD
#include <sys/sysctl.h>
#include <sys/time.h>
#include <unistd.h>
#if defined BENCHMARK_OS_FREEBSD || defined BENCHMARK_OS_MACOSX
#include <sys/sysctl.h>
#endif
#endif
#include <cerrno>
...
...
test/benchmark_test.cc
View file @
3c83ed5b
...
...
@@ -4,6 +4,7 @@
#include <math.h>
#include <stdint.h>
#include <cstdlib>
#include <iostream>
#include <limits>
#include <list>
...
...
test/filter_test.cc
View file @
3c83ed5b
...
...
@@ -3,6 +3,7 @@
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <limits>
...
...
@@ -73,12 +74,18 @@ int main(int argc, char* argv[]) {
TestReporter
test_reporter
;
benchmark
::
RunSpecifiedBenchmarks
(
&
test_reporter
);
// Make sure we ran all of the tests
const
size_t
count
=
test_reporter
.
GetCount
();
const
size_t
expected
=
(
argc
==
2
)
?
std
::
stoul
(
argv
[
1
])
:
count
;
if
(
count
!=
expected
)
{
std
::
cerr
<<
"ERROR: Expected "
<<
expected
<<
" tests to be ran but only "
<<
count
<<
" completed"
<<
std
::
endl
;
return
-
1
;
if
(
argc
==
2
)
{
// Make sure we ran all of the tests
std
::
stringstream
ss
(
argv
[
1
]);
size_t
expected
;
ss
>>
expected
;
const
size_t
count
=
test_reporter
.
GetCount
();
if
(
count
!=
expected
)
{
std
::
cerr
<<
"ERROR: Expected "
<<
expected
<<
" tests to be ran but only "
<<
count
<<
" completed"
<<
std
::
endl
;
return
-
1
;
}
}
return
0
;
}
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