Exemple #1
0
void htc_pm_monitor_work(struct work_struct *work)
{
	struct timespec ts;
	struct rtc_time tm;

	if (htc_pm_monitor_wq == NULL)
		return;

	getnstimeofday(&ts);
	rtc_time_to_tm(ts.tv_sec - (sys_tz.tz_minuteswest * 60), &tm);
	printk("[K] [PM] hTC PM Statistic start (%02d-%02d %02d:%02d:%02d) \n",
		tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
	htc_show_interrupts();
	htc_xo_block_clks_count_show();
	htc_xo_block_clks_count_clear();
	msm_xo_print_voters();
	htc_idle_stat_show(msm_htc_util_delay_time);
	htc_idle_stat_clear();
	htc_timer_stats_onoff('0');
	htc_timer_stats_show(300);/*Show timer events which greater than 300 every 10 sec*/
	htc_timer_stats_onoff('1');
	htc_print_active_wake_locks(WAKE_LOCK_IDLE);
	htc_print_active_wake_locks(WAKE_LOCK_SUSPEND);

	queue_delayed_work(htc_pm_monitor_wq, &htc_pm_delayed_work, msecs_to_jiffies(msm_htc_util_delay_time));

	htc_kernel_top();
	printk("[K] [PM] hTC PM Statistic done\n");
}
void htc_PM_monitor_work(struct work_struct *work)
{
	struct timespec ts;
	struct rtc_time tm;

	if (htc_pm_monitor_wq == NULL)
		return;

	getnstimeofday(&ts);
	rtc_time_to_tm(ts.tv_sec - (sys_tz.tz_minuteswest * 60), &tm);
	printk(KERN_INFO "[K] [PM] hTC PM Statistic ");
	printk(KERN_INFO "[K] %02d-%02d %02d:%02d:%02d \n", tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
	/* htc_show_interrupts(); */
	htc_idle_stat_show(HTC_PM_STATSTIC_DELAY);
	#if CONFIG_SMD_OFFSET_TCXO_STAT
	print_sleep_stat();
	#endif
	htc_idle_stat_clear();
	htc_timer_stats_OnOff('0');
	htc_timer_stats_show(300);
	htc_timer_stats_OnOff('1');
	htc_print_active_wake_locks(WAKE_LOCK_IDLE);
	htc_print_active_wake_locks(WAKE_LOCK_SUSPEND);

	queue_delayed_work(htc_pm_monitor_wq, &htc_pm_delayed_work, msecs_to_jiffies(HTC_PM_STATSTIC_DELAY));

	htc_kernel_top();
}
void htc_pm_monitor_work(struct work_struct *work)
{
	struct timespec ts;
	struct rtc_time tm;

	if (htc_pm_monitor_wq == NULL){
		printk(KERN_INFO "[K] hTc PM statistic is NILL.\n");
		return;
	}

	getnstimeofday(&ts);
	rtc_time_to_tm(ts.tv_sec - (sys_tz.tz_minuteswest * 60), &tm);
	printk(KERN_INFO "[K] [PM] hTC PM Statistic ");
	printk(KERN_INFO "[K] %02d-%02d %02d:%02d:%02d \n", tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);

	

	htc_idle_stat_show(msm_htc_util_delay_time);
	htc_idle_stat_clear();
	htc_timer_stats_OnOff('0');
	htc_timer_stats_show(300);
	htc_timer_stats_OnOff('1');
#if 0 
	htc_print_active_perf_locks();
#endif
	
	
	htc_print_active_wake_locks(WAKE_LOCK_SUSPEND);


	queue_delayed_work(htc_pm_monitor_wq, &htc_pm_delayed_work, msecs_to_jiffies(msm_htc_util_delay_time));
	htc_kernel_top();
}
static int try_to_freeze_tasks(bool sig_only)
{
	struct task_struct *g, *p;
	unsigned long end_time;
	unsigned int todo;
	struct timeval start, end;
	u64 elapsed_csecs64;
	unsigned int elapsed_csecs;
	unsigned int wakeup = 0;

	do_gettimeofday(&start);

	end_time = jiffies + TIMEOUT;
	while (true) {
		todo = 0;
		read_lock(&tasklist_lock);
		do_each_thread(g, p) {
			if (frozen(p) || !freezeable(p))
				continue;

			if (!freeze_task(p, sig_only))
				continue;

			/*
			 * Now that we've done set_freeze_flag, don't
			 * perturb a task in TASK_STOPPED or TASK_TRACED.
			 * It is "frozen enough".  If the task does wake
			 * up, it will immediately call try_to_freeze.
			 */
			if (!task_is_stopped_or_traced(p) &&
			    !freezer_should_skip(p))
				todo++;
		} while_each_thread(g, p);
		read_unlock(&tasklist_lock);
		if (todo && has_wake_lock(WAKE_LOCK_SUSPEND)) {
			wakeup = 1;
			#ifdef CONFIG_ARCH_MSM8X60_LTE
			/*Show active wakelock at this moment*/
			printk("[PM]Warning: Wakelock exists while freezing tasks\n");
			htc_print_active_wake_locks(WAKE_LOCK_SUSPEND);
			#endif
			break;
		}
		if (!todo || time_after(jiffies, end_time))
			break;

		/*
		 * We need to retry, but first give the freezing tasks some
		 * time to enter the regrigerator.
		 */
		msleep(10);
	}

	do_gettimeofday(&end);
	elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
	do_div(elapsed_csecs64, NSEC_PER_SEC / 100);
	elapsed_csecs = elapsed_csecs64;

	if (todo) {
		/* This does not unfreeze processes that are already frozen
		 * (we have slightly ugly calling convention in that respect,
		 * and caller must call thaw_processes() if something fails),
		 * but it cleans up leftover PF_FREEZE requests.
		 */
		if(wakeup) {
			printk("\n");
			printk(KERN_ERR "Freezing of %s aborted\n",
					sig_only ? "user space " : "tasks ");
		}
		else {
			printk("\n");
			printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
					"(%d tasks refusing to freeze):\n",
					elapsed_csecs / 100, elapsed_csecs % 100, todo);
		}
#ifdef CONFIG_MSM_WATCHDOG
		/* Suspend wdog until tasks are printed */
		msm_watchdog_suspend();
#endif
		read_lock(&tasklist_lock);
		do_each_thread(g, p) {
			task_lock(p);
			if (freezing(p) && !freezer_should_skip(p) &&
				elapsed_csecs > 100 && !wakeup)
				sched_show_task(p);
			cancel_freezing(p);
			task_unlock(p);
		} while_each_thread(g, p);
		read_unlock(&tasklist_lock);
#ifdef CONFIG_MSM_WATCHDOG
		msm_watchdog_resume();
#endif
	} else {