|
16 | 16 | * You should have received a copy of the GNU General Public License
|
17 | 17 | * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18 | 18 | */
|
19 |
| -#![deny(clippy::all, clippy::pedantic)] |
20 |
| -#![warn(clippy::nursery)] |
| 19 | +#![warn(clippy::nursery, clippy::all, clippy::pedantic)] |
21 | 20 | #![allow(clippy::module_name_repetitions)]
|
| 21 | +//! # frame-analyzer |
| 22 | +//! |
| 23 | +//! - This crate is used to monitor the frametime of the target app on the android device |
| 24 | +//! - Based on the EBPF and UPROBE implementations, you may need higher privileges (e.g. root) to use this crate properly |
| 25 | +//! - This IS NOT a bin crate, it uses some tricks (see [source](https://github.com/shadow3aaa/frame-analyzer-ebpf?tab=readme-ov-file)) to get it to work like a normal lib crate, even though it includes an EBPF program |
| 26 | +//! |
| 27 | +//! # Examples |
| 28 | +//! |
| 29 | +//! ```should_panic |
| 30 | +//! # use std::sync::{ |
| 31 | +//! # atomic::{AtomicBool, Ordering}, |
| 32 | +//! # Arc, |
| 33 | +//! # }; |
| 34 | +//! |
| 35 | +//! # use frame_analyzer::Analyzer; |
| 36 | +//! |
| 37 | +//! # fn main() -> anyhow::Result<()> { |
| 38 | +//! # let app_pid = 1; |
| 39 | +//! let pid = app_pid; |
| 40 | +//! let mut analyzer = Analyzer::new()?; |
| 41 | +//! analyzer.attach_app(pid)?; |
| 42 | +//! |
| 43 | +//! let running = Arc::new(AtomicBool::new(true)); |
| 44 | +//! |
| 45 | +//! { |
| 46 | +//! let running = running.clone(); |
| 47 | +//! ctrlc::set_handler(move || { |
| 48 | +//! running.store(false, Ordering::Release); |
| 49 | +//! })?; |
| 50 | +//! } |
| 51 | +//! |
| 52 | +//! while running.load(Ordering::Acquire) { |
| 53 | +//! if let Some((pid, frametime)) = analyzer.recv() { |
| 54 | +//! println!("process: {pid}, frametime: {frametime:?}"); |
| 55 | +//! } |
| 56 | +//! } |
| 57 | +//! |
| 58 | +//! # Ok(()) |
| 59 | +//! } |
| 60 | +//! ``` |
22 | 61 | mod analyze_target;
|
23 | 62 | mod ebpf;
|
24 | 63 | mod error;
|
|
0 commit comments