コード例 #1
0
static inline int msm_rpmstats_append_data_to_buf(char *buf,
		struct msm_rpm_stats_data_v2 *data, int buflength)
{
	char stat_type[5];
	u64 time_in_last_mode;
	u64 time_since_last_mode;
	u64 actual_last_sleep;

	stat_type[4] = 0;
	memcpy(stat_type, &data->stat_type, sizeof(u32));

	time_in_last_mode = data->last_exited_at - data->last_entered_at;
	time_in_last_mode = get_time_in_msec(time_in_last_mode);
	time_since_last_mode = arch_counter_get_cntpct() - data->last_exited_at;
	time_since_last_mode = get_time_in_sec(time_since_last_mode);
	actual_last_sleep = get_time_in_msec(data->accumulated);

	return  snprintf(buf , buflength,
		"RPM Mode:%s\n\t count:%d\ntime in last mode(msec):%llu\n"
		"time since last mode(sec):%llu\nactual last sleep(msec):%llu\n"
		"client votes: %#010x\n\n",
		stat_type, data->count, time_in_last_mode,
		time_since_last_mode, actual_last_sleep,
		data->client_votes);
}
コード例 #2
0
static int rpm_stats_resume(struct device *dev)
{
	void __iomem *reg =0;
	struct msm_rpm_stats_data_v2 data;
	int i, length;
	char stat_type[5];
	u64 time_in_last_mode;
	u64 time_since_last_mode;
	u64 actual_last_sleep;

	reg = ioremap_nocache(g_phys_addr_base, g_phys_size);
	if(!reg) {
		return 0;
	}

	for (i = 0, length = 0; i < 2; i++) {
		data.stat_type = msm_rpmstats_read_long_register_v2(reg, i,
				offsetof(struct msm_rpm_stats_data_v2, stat_type));
		data.count = msm_rpmstats_read_long_register_v2(reg, i,
				offsetof(struct msm_rpm_stats_data_v2, count));
		data.last_entered_at = msm_rpmstats_read_quad_register_v2(reg, i, 
				offsetof(struct msm_rpm_stats_data_v2, last_entered_at));
		data.last_exited_at = msm_rpmstats_read_quad_register_v2(reg, i,
				offsetof(struct msm_rpm_stats_data_v2, last_exited_at));
		data.accumulated = msm_rpmstats_read_quad_register_v2(reg, i, 
				offsetof(struct msm_rpm_stats_data_v2, accumulated));
		if(0 == i) {
			data.client_votes = msm_rpmstats_read_quad_register_v2(reg,	i, 
					offsetof(struct msm_rpm_stats_data_v2, client_votes));
			data.subsystem_votes = msm_rpmstats_read_quad_register_v2(reg, i, 
					offsetof(struct msm_rpm_stats_data_v2, subsystem_votes));
		}

		stat_type[4] = 0;
		memcpy(stat_type, &data.stat_type, sizeof(u32));

		time_in_last_mode = data.last_exited_at - data.last_entered_at;
		time_in_last_mode = get_time_in_msec(time_in_last_mode);
		time_since_last_mode = arch_counter_get_cntpct() - data.last_exited_at;
		time_since_last_mode = get_time_in_sec(time_since_last_mode);
		actual_last_sleep = get_time_in_msec(data.accumulated);

		if(0 == i) {
			printk("[RPM] Resume: RPM Mode:%s\n\t count:%d\n time in last mode(msec):%llu\n"
				"time since last mode(sec):%llu\n actual last sleep(msec):%llu\n"
				"Client votes: 0x%x, Subsystem votes: 0x%x\n",
				stat_type, data.count, time_in_last_mode,
				time_since_last_mode, actual_last_sleep, 
				data.client_votes, data.subsystem_votes);
		}
		else {
			printk("[RPM] Resume: RPM Mode:%s\n\t count:%d\n time in last mode(msec):%llu\n"
				"time since last mode(sec):%llu\n actual last sleep(msec):%llu\n",
				stat_type, data.count, time_in_last_mode,
				time_since_last_mode, actual_last_sleep);
		}
	}
コード例 #3
0
ファイル: rpm_stats.c プロジェクト: cpflayan/htc_kernel_a3
int rpm_getSubsysStickTime(int n, struct timeval *cur_t)
{
	void __iomem *reg;
	struct msm_rpm_stats_data_v3 data_v3;
	int ret = 0;

	if (rpm_stats_dev[DEV_V3].init) {
		reg = rpm_stats_dev[DEV_V3].reg_base;

		data_v3.total_duration = msm_rpmstats_read_quad_register_v3(reg,
			n, offsetof(struct msm_rpm_stats_data_v3, total_duration));

		switch (n)
		{
		case 0:
			if (aCPU.prev_duration == get_time_in_msec(data_v3.total_duration)) {
				if (!aCPU.start_time.tv_sec) {
					do_gettimeofday(&aCPU.start_time);
				} else {
					if (aCPU.start_time.tv_sec > 0 &&
						cur_t->tv_sec > aCPU.start_time.tv_sec)
						return cur_t->tv_sec - aCPU.start_time.tv_sec;
				}
			} else {
				aCPU.prev_duration = get_time_in_msec(data_v3.total_duration);
				if (aCPU.start_time.tv_sec)
					memset(&aCPU, 0, sizeof(struct trackStick));
			}
			break;
#ifdef CONFIG_ARCH_MSM8916
		case 2:
#endif
		case 3:
			if (wlanFW.prev_duration == get_time_in_msec(data_v3.total_duration)) {
				if (!wlanFW.start_time.tv_sec) {
					do_gettimeofday(&wlanFW.start_time);
				} else {
					if (wlanFW.start_time.tv_sec > 0 &&
						cur_t->tv_sec > wlanFW.start_time.tv_sec)
						return cur_t->tv_sec - wlanFW.start_time.tv_sec;
				}
			} else {
				wlanFW.prev_duration = get_time_in_msec(data_v3.total_duration);
				if (wlanFW.start_time.tv_sec)
					memset(&wlanFW, 0, sizeof(struct trackStick));
			}
			break;
		default:
			pr_info("invalid number when getSubsysStickTime");
			ret = -1;
			break;
		}
	}
コード例 #4
0
static inline int msm_rpmstats_append_data_to_buf_v3(char *buf,
		struct msm_rpm_stats_data_v3 *data, int buflength, int index)
{

	u64 total_time;

	total_time = data->total_duration;
	if (data->is_sleep_mode)
		total_time += (arch_counter_get_cntpct() - data->sleep_timestamp);

	total_time = get_time_in_msec(total_time);
	return  snprintf(buf , buflength,
		"sleep_info.%d (%d)\n count:%d\n total time(msec):%llu\n",
		index, data->is_sleep_mode, data->count, total_time);
}