-
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
base: master
Are you sure you want to change the base?
Conversation
Good! Please fix the CI and sign-off. (You could sign off a commit through |
abdc3d2
to
116668a
Compare
This is needed for windows support. Though the windows implementation is currently blank. It compiles and runs on windows and linux, but I haven't tested macos. Signed-off-by: Christian Jordan <[email protected]>
Signed-off-by: Christian Jordan <[email protected]>
they were moved into nix_impl/profiler in previous commit Signed-off-by: Christian Jordan <[email protected]>
Signed-off-by: Christian Jordan <[email protected]>
To make clippy happy the .unwrap on write! shouldn't fail Signed-off-by: Christian Jordan <[email protected]>
Signed-off-by: Christian Jordan <[email protected]>
116668a
to
20c4ad7
Compare
Makes clippy happy Signed-off-by: Christian Jordan <[email protected]>
src/platform/nix_impl/profiler.rs
Outdated
use crate::profiler::PROFILER; | ||
use crate::{MAX_DEPTH, MAX_THREAD_NAME}; | ||
|
||
pub fn register() -> Result<()> { |
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.
How about impl register in a trait? See /src/backtrace/mod.rs: trait Trace
. We'll need to tell the developers which functions are needed to add a new Profiler
(for different platform, or implementation)
src/report.rs
Outdated
@@ -6,8 +6,8 @@ use std::fmt::{Debug, Formatter}; | |||
use parking_lot::RwLock; | |||
|
|||
use crate::frames::{Frames, UnresolvedFrames}; | |||
use crate::platform::timer::ReportTiming; |
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.
Also, add a trait for ReportTiming
, to tell the developers that it should implement Clone
, and has a .get_frequency()
, .get_duration()
and .get_start_time()
🤔 .
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.
Do the same for validate
.
Thanks for your contribution again. You've done a really good job 🍻 . I was also thinking about adding more sampling methods (like add sampling methods based on |
+ moved write_thread_name_fallback into profiler, since it's platform agnostic Signed-off-by: Christian Jordan <[email protected]>
b4cb45d
to
c855009
Compare
Signed-off-by: Christian Jordan <[email protected]>
5f75b2f
to
e9f8cf7
Compare
I'm not sure what to do with ReportTiming since it currently just stores some info. I've made a trait for Timer instead that has a start and stop. let me know if anything should change. |
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.
I run the unit tests and examples on macos aarch64. Everything works fine as usual under both the dwarf and fp modes. There are some unimportant warnings about unused functions in tests. I can fix them for you later. |
criterion = {version = "0.3", optional = true} | ||
criterion = { version = "0.3", optional = true } | ||
|
||
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies] |
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
and macos
may fail
[target.'cfg(target_family = "unix")'.dependencies]
Rest of the code looks good
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 comment
The reason will be displayed to describe this comment to others. Learn more.
[target.'cfg(target_family = "unix")'.dependencies]
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
[target.'cfg(target_family = "unix")'.dependencies]
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 comment
The reason will be displayed to describe this comment to others. Learn more.
[target.'cfg(target_family = "unix")'.dependencies]
I also tested
as a dependency with our project and it compiles just fine. The target was Didn't have time to actually generate graph, but think it shall be fine as well. Will try tomorrow. |
Ah... actually flamegraphs functionality is still unimplemented on win :) |
@maksymsur pprof = { git = "https://github.com/Jardynq/pprof-rs/", branch = "windows-support", features = [
"flamegraph",
] } Though it's probably going to be a while before an actual release with windows support. |
Hi @maksymsur, @Jardynq is this now pending on Windows support for flamegraph? Would it be possible to move this along before that's fully resolved to get a fix for #151 ? |
Hi @maksymsur, @Jardynq, is there anything I can do to help this move along? |
I would also be interested in helping if someone could explain me the basics :) |
Hi @dveeden @AntoniosBarotsis sorry for late reply! |
Separated platform specific implementation into separate files.
This is needed for windows support.
Though the windows implementation is currently blank.
It compiles and runs on windows and linux, but I haven't tested macos.