Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=438e2ce68dfd4af4cfcec2f873564fb921db4bb5
Commit:     438e2ce68dfd4af4cfcec2f873564fb921db4bb5
Parent:     b842ee578eeb2c10303725e28edca130ede0397c
Author:     Rafael J. Wysocki <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 18 03:04:49 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Oct 18 14:37:19 2007 -0700

    freezer: measure freezing time
    
    Measure the time of the freezing of tasks, even if it doesn't fail.
    
    Signed-off-by: Rafael J. Wysocki <[EMAIL PROTECTED]>
    Acked-by: Pavel Machek <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/power/process.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/kernel/power/process.c b/kernel/power/process.c
index 3d98d7f..6533923 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)
        struct task_struct *g, *p;
        unsigned long end_time;
        unsigned int todo;
+       struct timeval start, end;
+       s64 elapsed_csecs64;
+       unsigned int elapsed_csecs;
+
+       do_gettimeofday(&start);
 
        end_time = jiffies + TIMEOUT;
        do {
@@ -194,6 +199,11 @@ static int try_to_freeze_tasks(int freeze_user_space)
                        break;
        } while (todo);
 
+       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,
@@ -201,10 +211,9 @@ static int try_to_freeze_tasks(int freeze_user_space)
                 * but it cleans up leftover PF_FREEZE requests.
                 */
                printk("\n");
-               printk(KERN_ERR "Freezing of %s timed out after %d seconds "
+               printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds 
"
                                "(%d tasks refusing to freeze):\n",
-                               freeze_user_space ? "user space " : "tasks ",
-                               TIMEOUT / HZ, todo);
+                               elapsed_csecs / 100, elapsed_csecs % 100, todo);
                show_state();
                read_lock(&tasklist_lock);
                do_each_thread(g, p) {
@@ -215,6 +224,9 @@ static int try_to_freeze_tasks(int freeze_user_space)
                        task_unlock(p);
                } while_each_thread(g, p);
                read_unlock(&tasklist_lock);
+       } else {
+               printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
+                       elapsed_csecs % 100);
        }
 
        return todo ? -EBUSY : 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to