-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate platform implementation #150
Open
Jardynq
wants to merge
9
commits into
tikv:master
Choose a base branch
from
Jardynq:seperate-platform-impl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
588ea16
Separated platform specific implementation into separate files
Jardynq d6a2d40
rename from platform_* to *_impl
Jardynq 35cbaa2
remove linux tests from profiler
Jardynq 46f2c30
move platform specific backtrace into ./platform
Jardynq 45d0a6c
Use fmt::write instead of push_str
Jardynq 20c4ad7
fix linux tests
Jardynq c12b87a
Moved trigger_lazy import into tests module
Jardynq c855009
Moved platform impl into traits
Jardynq e9f8cf7
fix write_thread_name_fallback and bench addr_validate
Jardynq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. | ||
|
||
// TODO Windows error is not finished | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum Error { | ||
#[cfg(target_os = "windows")] | ||
#[error("{0}")] | ||
NixError(#[from] nix::Error), | ||
OsError(i32), | ||
|
||
#[cfg(any(target_os = "linux", target_os = "macos"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
#[error("{0}")] | ||
OsError(#[from] nix::Error), | ||
|
||
#[error("{0}")] | ||
IoError(#[from] std::io::Error), | ||
#[error("create profiler error")] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#[cfg(any(target_os = "linux", target_os = "macos"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
mod nix_impl { | ||
mod addr_validate; | ||
mod profiler; | ||
mod timer; | ||
|
||
#[cfg(all( | ||
any(target_arch = "x86_64", target_arch = "aarch64"), | ||
feature = "frame-pointer", | ||
))] | ||
mod frame_pointer; | ||
#[cfg(all( | ||
any(target_arch = "x86_64", target_arch = "aarch64"), | ||
feature = "frame-pointer", | ||
))] | ||
pub use frame_pointer::Trace as TraceImpl; | ||
|
||
#[cfg(not(all( | ||
any(target_arch = "x86_64", target_arch = "aarch64"), | ||
feature = "frame-pointer", | ||
)))] | ||
#[path = "../backtrace_rs.rs"] | ||
mod backtrace_rs; | ||
#[cfg(not(all( | ||
any(target_arch = "x86_64", target_arch = "aarch64"), | ||
feature = "frame-pointer", | ||
)))] | ||
pub use backtrace_rs::Trace as TraceImpl; | ||
} | ||
|
||
#[cfg(target_os = "windows")] | ||
mod windows_impl { | ||
mod addr_validate; | ||
mod profiler; | ||
mod timer; | ||
|
||
#[cfg(feature = "frame-pointer")] | ||
std::compile_error!("frame-pointer feature is currently not supported on windows."); | ||
|
||
#[path = "../backtrace_rs.rs"] | ||
mod backtrace_rs; | ||
pub use backtrace_rs::Trace as TraceImpl; | ||
} | ||
|
||
#[cfg(any(target_os = "linux", target_os = "macos"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
pub use nix_impl::*; | ||
|
||
#[cfg(target_os = "windows")] | ||
pub use windows_impl::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's better to use more generic and inclusive template unless some other UNIX targets but tested
linux
andmacos
may failRest of the code looks good