-
Notifications
You must be signed in to change notification settings - Fork 42
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
Implement a high-level API and crate for ittapi #45
Conversation
High-level usage example: https://github.com/bnjbvr/wasmtime/blob/high-level-vtune/crates/jit/src/profiling/vtune_linux.rs |
cc: @jlb6740 |
Initial feedback:
|
Good idea! Did just that, and now the API resembles much the one from the C documentation, with naming that's closed to the one from the C documentation. This looks like a mid-level API now, but that seems fine; additional helpers can be built on top of this to make it really really easy to use. |
Quite satisfied with the current state of this crate now, calling it ready for review 🎉 |
@bnjbvr Hi .. so effectively this just hides the need to encapsulate calls with unsafe and other minor details to the api user, correct? Simplifies the ITTAPIs. How does someone who uses the abstraction know that a call is unsafe? |
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.
Had these comments pending and forgot to submit them.
@@ -0,0 +1 @@ | |||
../../ |
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 think the copy-c-library.ps1
script should also get an extra parent level due to this change.
ittapi-rs/ittapi/src/lib.rs
Outdated
MethodId(unsafe { ittapi_sys::iJIT_GetNewMethodID() }) | ||
} | ||
|
||
/// Notifies any `EventType` to Vtune. |
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.
/// Notifies any `EventType` to Vtune. | |
/// Notifies any `EventType` to VTune. |
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.
Did a round of checking capitalization:
- in Rust it's a bit uncommon to have two capital letters following each other, so kept
Vtune
, but I don't care too much about it. - used "VTune" in all comments though
The whole purpose of such a high-level crate is to hide all the unsafety. In general, the |
1e48d37
to
4a3d292
Compare
This is a work-in-progress of what a high-level API and crate could look like for ittapi. This creates a small workspace in
ittapi-rs
with two sub-crates:ittapi-sys
, which contains all the low-level bindings: it's the unmodified crate that's calledittapi-rs
right now.ittapi
, which contains higher-level bindings, and what ought to be sufficient for wasmtime.It would need to be cleaned up a bit, and commented, with examples, etc. But wanted to post early progress, if people wanted to try it out and confirm it works for their use case.