当前位置:操作系统 > 安卓/Android >>

修改测试apk读出的CPU主频

修改系统在sys下面的频率显示,在/drivers/cpufreq/cpufreq.c
/**
 * cpufreq_per_cpu_attr_read() / show_##file_name() -
 * print out cpufreq information
 *
 * Write out information from cpufreq_driver->policy[cpu]; object must be
 * "unsigned int".
 */
 
#define show_one(file_name, object) \
static ssize_t show_##file_name \
(struct cpufreq_policy *policy, char *buf)  \
{ \
return sprintf(buf, "%u\n", policy->object);
\
}
 
#define show_change(file_name, object)  \
static ssize_t show_##file_name \
(unsigned int val, char *buf) \
{ \
return sprintf(buf, "%u\n", 1200000);
\
}
 
show_one(cpuinfo_min_freq, cpuinfo.min_freq);
//show_one(cpuinfo_max_freq, cpuinfo.max_freq);
show_change(cpuinfo_max_freq, cpuinfo.max_freq);  //change by azad  for change the freq
show_one(cpuinfo_transition_latency, cpuinfo.transition_latency);
show_one(scaling_min_freq, min);
show_one(scaling_max_freq, max);
//show_one(scaling_cur_freq, cur);
show_change(scaling_cur_freq, cur);
 
 
cpuinfo.max_freq  系统的最大频率
 
scaling_cur_freq     系统当前的频率
 
修改这两个频率的的接口,不从系统中读取,直接写死
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,