Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
HermitCore
uhyve
Commits
7b905e99
Commit
7b905e99
authored
Jan 23, 2021
by
Stefan Lankes
Browse files
using atexit to dump the trace
parent
0c6e6821
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/uhyve.rs
View file @
7b905e99
#[macro_use]
extern
crate
log
;
#[macro_use]
extern
crate
clap
;
...
...
@@ -29,9 +28,18 @@ const DEFAULT_GUEST_SIZE: usize = 64 * 1024 * 1024;
// as a result destructors are not run and cleanup may not happen.
fn
main
()
{
#[cfg(feature
=
"instrument"
)]
let
events
=
rftrace_frontend
::
init
(
1000000
,
true
);
#[cfg(feature
=
"instrument"
)]
rftrace_frontend
::
enable
();
{
let
events
=
Box
::
new
(
rftrace_frontend
::
init
(
1000000
,
true
));
rftrace_frontend
::
enable
();
let
exit_closure
=
||
{
rftrace_frontend
::
dump_full_uftrace
(
*
events
,
"uhyve_trace"
,
"uhyve"
,
true
)
.expect
(
"Saving trace failed"
);
};
unsafe
{
libc
::
atexit
(
std
::
mem
::
transmute
(
exit_closure
));
}
}
env_logger
::
init
();
...
...
@@ -281,28 +289,14 @@ fn main() {
match
result
{
Err
(
x
)
=>
{
error!
(
"CPU {} crashes! {}"
,
tid
,
x
);
#[cfg(feature
=
"instrument"
)]
rftrace_frontend
::
dump_full_uftrace
(
events
,
"uhyve_trace"
,
"uhyve"
,
true
)
.expect
(
"Saving trace failed"
);
std
::
process
::
exit
(
libc
::
EXIT_FAILURE
);
}
Ok
(
exit_code
)
=>
{
if
let
Some
(
code
)
=
exit_code
{
#[cfg(feature
=
"instrument"
)]
rftrace_frontend
::
dump_full_uftrace
(
events
,
"uhyve_trace"
,
"uhyve"
,
true
,
)
.expect
(
"Saving trace failed"
);
std
::
process
::
exit
(
code
);
}
else
{
std
::
process
::
exit
(
libc
::
EXIT_FAILURE
);
}
exit_code
}
}
})
...
...
@@ -312,8 +306,4 @@ fn main() {
for
t
in
threads
{
t
.join
()
.unwrap
();
}
#[cfg(feature
=
"instrument"
)]
rftrace_frontend
::
dump_full_uftrace
(
events
,
"uhyve_trace"
,
"uhyve"
,
true
)
.expect
(
"Saving trace failed"
);
}
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