#include <sys/types.h>
#include <unistd.h>
+#include <cpu_boost_controller.hh>
#include <exception.hh>
#include <socket.hh>
#include <peer_credentials.hh>
}
void LuxManager::OnExecution() {
+ CPUBoostController::DoBoost(getpid(), CPUBoostController::Level::Strong, -1,
+ true);
std::vector<int> except_fds{read_socket_->GetFd(), write_socket_->GetFd(),
sigchld_socket_->GetFd()};
Util::CloseAllFds(except_fds);
use glib_sys::*;
use libc::*;
use std::mem;
+use std::process;
use tizen_bundle::*;
use tizen_parcel::*;
fn security_manager_prepare_app_candidate() -> c_int;
}
+#[repr(C)]
+pub struct ResourcePidInfo {
+ pid: c_int,
+ tid: *mut c_int,
+ tid_count: c_int,
+}
+
+#[link(name = "capi-system-resource")]
+extern "C" {
+ fn resource_clear_cpu_boosting(pid: ResourcePidInfo) -> c_int;
+}
+
pub struct Lux {
mainloop: *mut GMainLoop,
app_labels_monitor: AppLabelsMonitor,
}
self.app_labels_monitor.init();
+ self.clear_boosting();
unsafe { g_main_loop_run(self.mainloop) }
self.app_labels_monitor.dispose();
Ok(())
Ok(())
}
+
+ fn clear_boosting(&self) {
+ let mut pid: c_int = process::id() as c_int;
+ let mut resource_pid = ResourcePidInfo {
+ pid: 0,
+ tid: &mut pid,
+ tid_count: 1,
+ };
+ unsafe { resource_clear_cpu_boosting(resource_pid); }
+ }
}