Ejemplo n.º 1
0
static int suspend_stats_show(struct seq_file *s, void *unused)
{
	int i, index, last_dev, last_errno, last_step;

	last_dev = suspend_stats.last_failed_dev + REC_FAILED_NUM - 1;
	last_dev %= REC_FAILED_NUM;
	last_errno = suspend_stats.last_failed_errno + REC_FAILED_NUM - 1;
	last_errno %= REC_FAILED_NUM;
	last_step = suspend_stats.last_failed_step + REC_FAILED_NUM - 1;
	last_step %= REC_FAILED_NUM;
	seq_printf(s, "%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n"
			"%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n",
			"success", suspend_stats.success,
			"fail", suspend_stats.fail,
			"failed_freeze", suspend_stats.failed_freeze,
			"failed_prepare", suspend_stats.failed_prepare,
			"failed_suspend", suspend_stats.failed_suspend,
			"failed_suspend_late",
				suspend_stats.failed_suspend_late,
			"failed_suspend_noirq",
				suspend_stats.failed_suspend_noirq,
			"failed_resume", suspend_stats.failed_resume,
			"failed_resume_early",
				suspend_stats.failed_resume_early,
			"failed_resume_noirq",
				suspend_stats.failed_resume_noirq);
	seq_printf(s,	"failures:\n  last_failed_dev:\t%-s\n",
			suspend_stats.failed_devs[last_dev]);
	for (i = 1; i < REC_FAILED_NUM; i++) {
		index = last_dev + REC_FAILED_NUM - i;
		index %= REC_FAILED_NUM;
		seq_printf(s, "\t\t\t%-s\n",
			suspend_stats.failed_devs[index]);
	}
	seq_printf(s,	"  last_failed_errno:\t%-d\n",
			suspend_stats.errno[last_errno]);
	for (i = 1; i < REC_FAILED_NUM; i++) {
		index = last_errno + REC_FAILED_NUM - i;
		index %= REC_FAILED_NUM;
		seq_printf(s, "\t\t\t%-d\n",
			suspend_stats.errno[index]);
	}
	seq_printf(s,	"  last_failed_step:\t%-s\n",
			suspend_step_name(
				suspend_stats.failed_steps[last_step]));
	for (i = 1; i < REC_FAILED_NUM; i++) {
		index = last_step + REC_FAILED_NUM - i;
		index %= REC_FAILED_NUM;
		seq_printf(s, "\t\t\t%-s\n",
			suspend_step_name(
				suspend_stats.failed_steps[index]));
	}

	return 0;
}
Ejemplo n.º 2
0
static int suspend_stats_show(struct seq_file *s, void *unused)
{
	int i, index, last_dev, last_errno, last_step;

	last_dev = suspend_stats.last_failed_dev + REC_FAILED_NUM - 1;
	last_dev %= REC_FAILED_NUM;
	last_errno = suspend_stats.last_failed_errno + REC_FAILED_NUM - 1;
	last_errno %= REC_FAILED_NUM;
	last_step = suspend_stats.last_failed_step + REC_FAILED_NUM - 1;
	last_step %= REC_FAILED_NUM;
	seq_printf(s, "%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n"
			"%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n",
			"success", suspend_stats.success,
			"fail", suspend_stats.fail,
			"failed_freeze", suspend_stats.failed_freeze,
			"failed_prepare", suspend_stats.failed_prepare,
			"failed_suspend", suspend_stats.failed_suspend,
			"failed_suspend_late",
				suspend_stats.failed_suspend_late,
			"failed_suspend_noirq",
				suspend_stats.failed_suspend_noirq,
			"failed_resume", suspend_stats.failed_resume,
			"failed_resume_early",
				suspend_stats.failed_resume_early,
			"failed_resume_noirq",
				suspend_stats.failed_resume_noirq);
	seq_printf(s,	"failures:\n  last_failed_dev:\t%-s\n",
			suspend_stats.failed_devs[last_dev]);
	for (i = 1; i < REC_FAILED_NUM; i++) {
		index = last_dev + REC_FAILED_NUM - i;
		index %= REC_FAILED_NUM;
		seq_printf(s, "\t\t\t%-s\n",
			suspend_stats.failed_devs[index]);
	}
	seq_printf(s,	"  last_failed_errno:\t%-d\n",
			suspend_stats.errno[last_errno]);
	for (i = 1; i < REC_FAILED_NUM; i++) {
		index = last_errno + REC_FAILED_NUM - i;
		index %= REC_FAILED_NUM;
		seq_printf(s, "\t\t\t%-d\n",
			suspend_stats.errno[index]);
	}
	seq_printf(s,	"  last_failed_step:\t%-s\n",
			suspend_step_name(
				suspend_stats.failed_steps[last_step]));
	for (i = 1; i < REC_FAILED_NUM; i++) {
		index = last_step + REC_FAILED_NUM - i;
		index %= REC_FAILED_NUM;
		seq_printf(s, "\t\t\t%-s\n",
			suspend_step_name(
				suspend_stats.failed_steps[index]));
	}

#ifdef CONFIG_PM_WAKEUP_TIMES
	seq_printf(s,	"%s\n%s  %lldms (%s %lldms %s %lldms)\n" \
			"%s  %lldms (%s %lldms %s %lldms)\n" \
			"%s  %lldms (%s %lldms %s %lldms)\n" \
			"%s  %lldms\n",
		"suspend time:",
		"  min:", ktime_to_ms(ktime_sub(
			suspend_stats.suspend_min_time.end,
			suspend_stats.suspend_min_time.start)),
		"start:", ktime_to_ms(suspend_stats.suspend_min_time.start),
		"end:", ktime_to_ms(suspend_stats.suspend_min_time.end),
		"  max:", ktime_to_ms(ktime_sub(
			suspend_stats.suspend_max_time.end,
			suspend_stats.suspend_max_time.start)),
		"start:", ktime_to_ms(suspend_stats.suspend_max_time.start),
		"end:", ktime_to_ms(suspend_stats.suspend_max_time.end),
		"  last:", ktime_to_ms(ktime_sub(
			suspend_stats.suspend_last_time.end,
			suspend_stats.suspend_last_time.start)),
		"start:", ktime_to_ms(suspend_stats.suspend_last_time.start),
		"end:", ktime_to_ms(suspend_stats.suspend_last_time.end),
		"  avg:", ktime_to_ms(suspend_stats.suspend_avg_time));

	seq_printf(s,	"%s\n%s  %lldms (%s %lldms %s %lldms)\n" \
			"%s  %lldms (%s %lldms %s %lldms)\n" \
			"%s  %lldms (%s %lldms %s %lldms)\n" \
			"%s  %lldms\n",
		"resume time:",
		"  min:", ktime_to_ms(ktime_sub(
			suspend_stats.resume_min_time.end,
			suspend_stats.resume_min_time.start)),
		"start:", ktime_to_ms(suspend_stats.resume_min_time.start),
		"end:", ktime_to_ms(suspend_stats.resume_min_time.end),
		"  max:", ktime_to_ms(ktime_sub(
			suspend_stats.resume_max_time.end,
			suspend_stats.resume_max_time.start)),
		"start:", ktime_to_ms(suspend_stats.resume_max_time.start),
		"end:", ktime_to_ms(suspend_stats.resume_max_time.end),
		"  last:", ktime_to_ms(ktime_sub(
			suspend_stats.resume_last_time.end,
			suspend_stats.resume_last_time.start)),
		"start:", ktime_to_ms(suspend_stats.resume_last_time.start),
		"end:", ktime_to_ms(suspend_stats.resume_last_time.end),
		"  avg:", ktime_to_ms(suspend_stats.resume_avg_time));
#endif
	return 0;
}