diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/Makefile | 2 | ||||
-rw-r--r-- | kernel/power/hibernate.c | 30 | ||||
-rw-r--r-- | kernel/power/swsusp.c | 29 |
3 files changed, 31 insertions, 30 deletions
diff --git a/kernel/power/Makefile b/kernel/power/Makefile index c3b81c30e5d5..43191815f874 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile | |||
@@ -8,7 +8,7 @@ obj-$(CONFIG_PM_SLEEP) += console.o | |||
8 | obj-$(CONFIG_FREEZER) += process.o | 8 | obj-$(CONFIG_FREEZER) += process.o |
9 | obj-$(CONFIG_SUSPEND) += suspend.o | 9 | obj-$(CONFIG_SUSPEND) += suspend.o |
10 | obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o | 10 | obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o |
11 | obj-$(CONFIG_HIBERNATION) += swsusp.o hibernate.o snapshot.o swap.o user.o | 11 | obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o |
12 | obj-$(CONFIG_HIBERNATION_NVS) += hibernate_nvs.o | 12 | obj-$(CONFIG_HIBERNATION_NVS) += hibernate_nvs.o |
13 | 13 | ||
14 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o | 14 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 04a9e90d248f..bbfe472d7524 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -32,6 +32,7 @@ static int noresume = 0; | |||
32 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; | 32 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; |
33 | dev_t swsusp_resume_device; | 33 | dev_t swsusp_resume_device; |
34 | sector_t swsusp_resume_block; | 34 | sector_t swsusp_resume_block; |
35 | int in_suspend __nosavedata = 0; | ||
35 | 36 | ||
36 | enum { | 37 | enum { |
37 | HIBERNATION_INVALID, | 38 | HIBERNATION_INVALID, |
@@ -202,6 +203,35 @@ static void platform_recover(int platform_mode) | |||
202 | } | 203 | } |
203 | 204 | ||
204 | /** | 205 | /** |
206 | * swsusp_show_speed - print the time elapsed between two events. | ||
207 | * @start: Starting event. | ||
208 | * @stop: Final event. | ||
209 | * @nr_pages - number of pages processed between @start and @stop | ||
210 | * @msg - introductory message to print | ||
211 | */ | ||
212 | |||
213 | void swsusp_show_speed(struct timeval *start, struct timeval *stop, | ||
214 | unsigned nr_pages, char *msg) | ||
215 | { | ||
216 | s64 elapsed_centisecs64; | ||
217 | int centisecs; | ||
218 | int k; | ||
219 | int kps; | ||
220 | |||
221 | elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start); | ||
222 | do_div(elapsed_centisecs64, NSEC_PER_SEC / 100); | ||
223 | centisecs = elapsed_centisecs64; | ||
224 | if (centisecs == 0) | ||
225 | centisecs = 1; /* avoid div-by-zero */ | ||
226 | k = nr_pages * (PAGE_SIZE / 1024); | ||
227 | kps = (k * 100) / centisecs; | ||
228 | printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n", | ||
229 | msg, k, | ||
230 | centisecs / 100, centisecs % 100, | ||
231 | kps / 1000, (kps % 1000) / 10); | ||
232 | } | ||
233 | |||
234 | /** | ||
205 | * create_image - freeze devices that need to be frozen with interrupts | 235 | * create_image - freeze devices that need to be frozen with interrupts |
206 | * off, create the hibernation image and thaw those devices. Control | 236 | * off, create the hibernation image and thaw those devices. Control |
207 | * reappears in this routine after a restore. | 237 | * reappears in this routine after a restore. |
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 57222d2089b8..5b3601bd1893 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -56,32 +56,3 @@ | |||
56 | #include "power.h" | 56 | #include "power.h" |
57 | 57 | ||
58 | int in_suspend __nosavedata = 0; | 58 | int in_suspend __nosavedata = 0; |
59 | |||
60 | /** | ||
61 | * swsusp_show_speed - print the time elapsed between two events represented by | ||
62 | * @start and @stop | ||
63 | * | ||
64 | * @nr_pages - number of pages processed between @start and @stop | ||
65 | * @msg - introductory message to print | ||
66 | */ | ||
67 | |||
68 | void swsusp_show_speed(struct timeval *start, struct timeval *stop, | ||
69 | unsigned nr_pages, char *msg) | ||
70 | { | ||
71 | s64 elapsed_centisecs64; | ||
72 | int centisecs; | ||
73 | int k; | ||
74 | int kps; | ||
75 | |||
76 | elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start); | ||
77 | do_div(elapsed_centisecs64, NSEC_PER_SEC / 100); | ||
78 | centisecs = elapsed_centisecs64; | ||
79 | if (centisecs == 0) | ||
80 | centisecs = 1; /* avoid div-by-zero */ | ||
81 | k = nr_pages * (PAGE_SIZE / 1024); | ||
82 | kps = (k * 100) / centisecs; | ||
83 | printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n", | ||
84 | msg, k, | ||
85 | centisecs / 100, centisecs % 100, | ||
86 | kps / 1000, (kps % 1000) / 10); | ||
87 | } | ||