Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
085b2619
Commit
085b2619
authored
Aug 30, 2021
by
Pascal Palenda
Browse files
Add test for profiler json output
parent
c30395db
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/CMakeLists.txt
View file @
085b2619
...
...
@@ -94,6 +94,15 @@ if (ITA_BASE_WITH_JSON_SUPPORT)
set_property
(
TARGET ITABaseUtilsJSONTest PROPERTY FOLDER
"Tests/ITABase"
)
install
(
TARGETS ITABaseUtilsJSONTest RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
# ######################################################################################################################
add_executable
(
ITABaseProfilerJSONTest ITABaseProfilerJSONTest.cpp
)
target_link_libraries
(
ITABaseProfilerJSONTest PUBLIC ITABase::ITABase
)
set_property
(
TARGET ITABaseProfilerJSONTest PROPERTY FOLDER
"Tests/ITABase"
)
install
(
TARGETS ITABaseProfilerJSONTest RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
endif
()
# ######################################################################################################################
...
...
tests/ITABaseProfilerJSONTest.cpp
0 → 100644
View file @
085b2619
#include
<ITAProfiler/profiler.h>
#include
<fstream>
#include
<iostream>
#include
<sstream>
int
main
(
int
nArgsIn
,
char
**
pccArgs
)
{
ITA_PROFILER_NAME_THREAD_MAIN
(
);
ITA_PROFILER_FUNCTION
(
);
ITA_PROFILER_SECTION
(
"Loop"
);
for
(
auto
i
=
0
;
i
<
10
;
i
++
)
{
ITA_PROFILER_EVENT_COUNT
(
"event"
)
ITA_PROFILER_VALUE
(
"i"
,
i
)
}
ITA_PROFILER_END_SECTION
(
);
try
{
std
::
ofstream
myfile
;
myfile
.
open
(
"example.json"
);
myfile
<<
ITAProfiler
::
ProfilerToJson
(
).
str
(
);
myfile
.
close
(
);
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
e
.
what
(
);
}
return
0
;
}
Write
Preview
Supports
Markdown
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