Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
e2bced6b
Commit
e2bced6b
authored
May 30, 2017
by
Jens Korinth
Browse files
benchmark: Trap SIGINT and exit cleanly in case of exceptions
parent
f274fe25
Changes
1
Show whitespace changes
Inline
Side-by-side
arch/tests/tapasco_benchmark.cpp
View file @
e2bced6b
...
...
@@ -11,6 +11,7 @@
#include
<sstream>
#include
<chrono>
#include
<ctime>
#include
<csignal>
#include
<vector>
#include
<sys/utsname.h>
#include
<tapasco_api.hpp>
...
...
@@ -60,7 +61,16 @@ struct job_throughput_t {
};
}
};
void
signalHandler
(
int
sig
)
{
cerr
<<
"Signal %d received, aborting."
<<
endl
;
endwin
();
exit
(
1
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
// trap ctrl-c
signal
(
SIGINT
,
signalHandler
);
try
{
Tapasco
tapasco
;
TransferSpeed
tp
{
tapasco
};
InterruptLatency
il
{
tapasco
};
...
...
@@ -165,5 +175,9 @@ int main(int argc, const char *argv[]) {
ofstream
f
(
argc
>=
2
?
argv
[
1
]
:
ss
.
str
());
f
<<
benchmark
.
dump
();
f
.
close
();
}
catch
(...)
{
endwin
();
throw
;
}
}
/* vim: set foldmarker=@{,@} foldlevel=0 foldmethod=marker : */
Jens Korinth
@jk
mentioned in commit
a831b501
·
Jul 14, 2017
mentioned in commit
a831b501
mentioned in commit a831b5015df6bd8f8d23ddd334a3b1159392de92
Toggle commit list
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