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
LARN
X-Lap
Commits
54bfa7e2
Commit
54bfa7e2
authored
Feb 16, 2021
by
Sven Liefgen
Browse files
Cosmetics
parent
06620b44
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib.rs
View file @
54bfa7e2
...
...
@@ -104,22 +104,22 @@ pub fn get_timestamp_cycle() -> u64 {
current_cycle
()
}
impl
TimestampTable
{
/// Install a timestamp table
///
/// Allocate memory for the empty timestamp tables and store pointers in the XLAP static
pub
unsafe
fn
install
()
{
ZERO
=
Some
(
Instant
::
now
());
for
ptr
in
XLAP
.iter
()
{
// Create a zeroed Timestamp table
let
table
:
TimestampTable
=
std
::
mem
::
zeroed
();
// Stop managing the memory for the table
let
table
=
Box
::
into_raw
(
Box
::
new
(
table
));
// Store the pointer to the table in an atomic
ptr
.store
(
table
,
Ordering
::
Release
);
}
/// Install a timestamp table
///
/// Allocate memory for the empty timestamp tables and store pointers in the XLAP static
pub
unsafe
fn
init
()
{
ZERO
=
Some
(
Instant
::
now
());
for
ptr
in
XLAP
.iter
()
{
// Create a zeroed Timestamp table
let
table
:
TimestampTable
=
std
::
mem
::
zeroed
();
// Stop managing the memory for the table
let
table
=
Box
::
into_raw
(
Box
::
new
(
table
));
// Store the pointer to the table in an atomic
ptr
.store
(
table
,
Ordering
::
Release
);
}
}
impl
TimestampTable
{
/// Dump the collected timestamps to a csv file
pub
unsafe
fn
dump_all
(
file
:
&
str
)
->
std
::
io
::
Result
<
()
>
{
Self
::
dump
(
file
,
Kind
::
iter
()
.collect
::
<
Vec
<
_
>>
()
.as_slice
())
...
...
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