aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-10-18 06:04:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:19 -0400
commit438e2ce68dfd4af4cfcec2f873564fb921db4bb5 (patch)
tree685262ee1f983001db52df4253548f03d98dd33f
parentb842ee578eeb2c10303725e28edca130ede0397c (diff)
freezer: measure freezing time
Measure the time of the freezing of tasks, even if it doesn't fail. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/power/process.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 3d98d7f99b14..6533923e711b 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -168,6 +168,11 @@ static int try_to_freeze_tasks(int freeze_user_space)
168 struct task_struct *g, *p; 168 struct task_struct *g, *p;
169 unsigned long end_time; 169 unsigned long end_time;
170 unsigned int todo; 170 unsigned int todo;
171 struct timeval start, end;
172 s64 elapsed_csecs64;
173 unsigned int elapsed_csecs;
174
175 do_gettimeofday(&start);
171 176
172 end_time = jiffies + TIMEOUT; 177 end_time = jiffies + TIMEOUT;
173 do { 178 do {
@@ -194,6 +199,11 @@ static int try_to_freeze_tasks(int freeze_user_space)
194 break; 199 break;
195 } while (todo); 200 } while (todo);
196 201
202 do_gettimeofday(&end);
203 elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
204 do_div(elapsed_csecs64, NSEC_PER_SEC / 100);
205 elapsed_csecs = elapsed_csecs64;
206
197 if (todo) { 207 if (todo) {
198 /* This does not unfreeze processes that are already frozen 208 /* This does not unfreeze processes that are already frozen
199 * (we have slightly ugly calling convention in that respect, 209 * (we have slightly ugly calling convention in that respect,
@@ -201,10 +211,9 @@ static int try_to_freeze_tasks(int freeze_user_space)
201 * but it cleans up leftover PF_FREEZE requests. 211 * but it cleans up leftover PF_FREEZE requests.
202 */ 212 */
203 printk("\n"); 213 printk("\n");
204 printk(KERN_ERR "Freezing of %s timed out after %d seconds " 214 printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
205 "(%d tasks refusing to freeze):\n", 215 "(%d tasks refusing to freeze):\n",
206 freeze_user_space ? "user space " : "tasks ", 216 elapsed_csecs / 100, elapsed_csecs % 100, todo);
207 TIMEOUT / HZ, todo);
208 show_state(); 217 show_state();
209 read_lock(&tasklist_lock); 218 read_lock(&tasklist_lock);
210 do_each_thread(g, p) { 219 do_each_thread(g, p) {
@@ -215,6 +224,9 @@ static int try_to_freeze_tasks(int freeze_user_space)
215 task_unlock(p); 224 task_unlock(p);
216 } while_each_thread(g, p); 225 } while_each_thread(g, p);
217 read_unlock(&tasklist_lock); 226 read_unlock(&tasklist_lock);
227 } else {
228 printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
229 elapsed_csecs % 100);
218 } 230 }
219 231
220 return todo ? -EBUSY : 0; 232 return todo ? -EBUSY : 0;