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
2b11e197
Commit
2b11e197
authored
Mar 19, 2021
by
Sven Liefgen
Browse files
Clean up unused warnings if disabled
parent
c24c5388
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib.rs
View file @
2b11e197
use
std
::
convert
::
AsRef
;
use
std
::
io
::
prelude
::
*
;
use
std
::
sync
::
atomic
::
AtomicPtr
;
use
std
::
sync
::
atomic
::
Ordering
;
#[cfg(feature
=
"xlap"
)]
use
std
::{
convert
::
AsRef
,
io
::
prelude
::
*
,
sync
::
atomic
::{
AtomicPtr
,
Ordering
},
};
use
std
::
time
::
Instant
;
#[cfg(feature
=
"xlap"
)]
use
strum
::{
AsRefStr
,
EnumCount
,
EnumIter
,
IntoEnumIterator
};
// Include the correct function for cycle counts depending on the architecture
#[cfg(target_arch
=
"x86"
)]
#[cfg(
all(
target_arch
=
"x86"
,
feature
=
"xlap"
)
)]
use
core
::
arch
::
x86
::
_rdtsc
as
current_cycle
;
#[cfg(target_arch
=
"x86_64"
)]
#[cfg(
all(
target_arch
=
"x86_64"
,
feature
=
"xlap"
)
)]
use
core
::
arch
::
x86_64
::
_rdtsc
as
current_cycle
;
// On all other architectures there is no cycle counting, so just set it to zero
#[cfg(not(any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
)))]
#[cfg(
all(
not(any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
))
,
feature
=
"xlap"
)
)]
#[inline(always)]
pub
unsafe
fn
current_cycle
()
->
u64
{
0
...
...
@@ -41,6 +44,7 @@ include!(concat!(env!("OUT_DIR"), "/xlap_generated.rs"));
// ---------------------------------------------
/// A moment in time, expressed in cycles and time
#[cfg(feature
=
"xlap"
)]
struct
Timestamp
{
c
:
u64
,
t
:
Instant
,
...
...
@@ -205,9 +209,9 @@ macro_rules! kind {
(
$kind:expr
)
=>
{
{
#[cfg(feature
=
"xlap"
)]
$kind
{
$kind
}
#[cfg(not(feature
=
"xlap"
))]
$crate
::
Kind
::
NoKind
{
$crate
::
Kind
::
NoKind
}
}
}
}
...
...
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