Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
fed22f2f
Commit
fed22f2f
authored
Mar 20, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11074 from alalek:android_log_messages
parents
9fd32ca5
8781ee97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
logger.cpp
modules/core/src/logger.cpp
+21
-2
system.cpp
modules/core/src/system.cpp
+9
-7
No files found.
modules/core/src/logger.cpp
View file @
fed22f2f
...
...
@@ -11,6 +11,10 @@
#include <iostream>
#include <fstream>
#ifdef __ANDROID__
# include <android/log.h>
#endif
namespace
cv
{
namespace
utils
{
namespace
logging
{
...
...
@@ -62,8 +66,7 @@ namespace internal {
void
writeLogMessage
(
LogLevel
logLevel
,
const
char
*
message
)
{
const
int
threadID
=
cv
::
utils
::
getThreadID
();
std
::
ostream
*
out
=
(
logLevel
<=
LOG_LEVEL_WARNING
)
?
&
std
::
cerr
:
&
std
::
cout
;
std
::
stringstream
ss
;
std
::
ostringstream
ss
;
switch
(
logLevel
)
{
case
LOG_LEVEL_FATAL
:
ss
<<
"[FATAL:"
<<
threadID
<<
"] "
<<
message
<<
std
::
endl
;
break
;
...
...
@@ -75,6 +78,22 @@ void writeLogMessage(LogLevel logLevel, const char* message)
default
:
return
;
}
#ifdef __ANDROID__
int
android_logLevel
=
ANDROID_LOG_INFO
;
switch
(
logLevel
)
{
case
LOG_LEVEL_FATAL
:
android_logLevel
=
ANDROID_LOG_FATAL
;
break
;
case
LOG_LEVEL_ERROR
:
android_logLevel
=
ANDROID_LOG_ERROR
;
break
;
case
LOG_LEVEL_WARNING
:
android_logLevel
=
ANDROID_LOG_WARN
;
break
;
case
LOG_LEVEL_INFO
:
android_logLevel
=
ANDROID_LOG_INFO
;
break
;
case
LOG_LEVEL_DEBUG
:
android_logLevel
=
ANDROID_LOG_DEBUG
;
break
;
case
LOG_LEVEL_VERBOSE
:
android_logLevel
=
ANDROID_LOG_VERBOSE
;
break
;
default
:
break
;
}
__android_log_print
(
android_logLevel
,
"OpenCV/"
CV_VERSION
,
"%s"
,
ss
.
str
().
c_str
());
#endif
std
::
ostream
*
out
=
(
logLevel
<=
LOG_LEVEL_WARNING
)
?
&
std
::
cerr
:
&
std
::
cout
;
(
*
out
)
<<
ss
.
str
();
if
(
logLevel
<=
LOG_LEVEL_WARNING
)
(
*
out
)
<<
std
::
flush
;
...
...
modules/core/src/system.cpp
View file @
fed22f2f
...
...
@@ -47,6 +47,8 @@
#include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/core/utils/trace.private.hpp>
#include <opencv2/core/utils/logger.hpp>
namespace
cv
{
static
Mutex
*
__initialization_mutex
=
NULL
;
...
...
@@ -412,24 +414,24 @@ struct HWFeatures
have
[
CV_CPU_FP16
]
=
true
;
#elif defined __arm__ && defined __ANDROID__
#if defined HAVE_CPUFEATURES
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"calling android_getCpuFeatures() ..."
);
CV_LOG_INFO
(
NULL
,
"calling android_getCpuFeatures() ..."
);
uint64_t
features
=
android_getCpuFeatures
();
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"calling android_getCpuFeatures() ... Done (%llx)"
,
features
);
CV_LOG_INFO
(
NULL
,
cv
::
format
(
"calling android_getCpuFeatures() ... Done (%llx)"
,
(
long
long
)
features
)
);
have
[
CV_CPU_NEON
]
=
(
features
&
ANDROID_CPU_ARM_FEATURE_NEON
)
!=
0
;
have
[
CV_CPU_FP16
]
=
(
features
&
ANDROID_CPU_ARM_FEATURE_VFP_FP16
)
!=
0
;
#else
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"cpufeatures library is not available for CPU detection"
);
CV_LOG_INFO
(
NULL
,
"cpufeatures library is not available for CPU detection"
);
#if CV_NEON
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"- NEON instructions is enabled via build flags"
);
CV_LOG_INFO
(
NULL
,
"- NEON instructions is enabled via build flags"
);
have
[
CV_CPU_NEON
]
=
true
;
#else
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"- NEON instructions is NOT enabled via build flags"
);
CV_LOG_INFO
(
NULL
,
"- NEON instructions is NOT enabled via build flags"
);
#endif
#if CV_FP16
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"- FP16 instructions is enabled via build flags"
);
CV_LOG_INFO
(
NULL
,
"- FP16 instructions is enabled via build flags"
);
have
[
CV_CPU_FP16
]
=
true
;
#else
__android_log_print
(
ANDROID_LOG_INFO
,
"OpenCV"
,
"- FP16 instructions is NOT enabled via build flags"
);
CV_LOG_INFO
(
NULL
,
"- FP16 instructions is NOT enabled via build flags"
);
#endif
#endif
#elif defined __arm__
...
...
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