Skip to content

Commit

Permalink
fix: 部分游戏无法接收到帧数据
Browse files Browse the repository at this point in the history
在第五人格测试时发现,如果在游戏刚启动时attach bpf程序,过一会后frame-analyzer-ebpf将收不到任何数据。重新attach即可正常工作。

目前原因未知。
  • Loading branch information
shadow3aaa committed Oct 14, 2024
1 parent 42bea01 commit c51dd84
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/framework/scheduler/looper/buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ impl Buffer {
}

self.frametime_state.frametimes.push_front(d);
self.try_calculate(extension);
}

fn try_calculate(&mut self, extension: &Extension) {
if unlikely(self.buffer_state.calculate_timer.elapsed() >= Duration::from_secs(1)) {
self.buffer_state.calculate_timer = Instant::now();
self.calculate_current_fps();
Expand All @@ -124,7 +127,8 @@ impl Buffer {
self.buffer_state.working_state_timer = Instant::now();
}

pub fn additional_frametime(&mut self) {
pub fn additional_frametime(&mut self, extension: &Extension) {
self.frametime_state.additional_frametime = self.buffer_state.last_update.elapsed();
self.try_calculate(extension);
}
}
2 changes: 1 addition & 1 deletion src/framework/scheduler/looper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl Looper {
self.fas_state.janked = true;
#[cfg(debug_assertions)]
debug!("janked: {}", self.fas_state.janked);
buffer.additional_frametime();
buffer.additional_frametime(&self.extension);
self.do_policy();
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/framework/scheduler/looper/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ impl Looper {
self.fas_state.working_state = State::NotWorking;
self.cleaner.undo_cleanup();
self.controller.init_default(&self.extension);
if let Some(buffer) = &self.fas_state.buffer {
let _ = self.analyzer.detach_app(buffer.package_info.pid);
}
self.extension.trigger_extentions(ApiV0::StopFas);
self.extension.trigger_extentions(ApiV1::StopFas);
self.extension.trigger_extentions(ApiV2::StopFas);
Expand Down

0 comments on commit c51dd84

Please sign in to comment.