Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Issue 4191002: AU: Nice for 2 hours, then normal priority. (Closed)

Created:
10 years, 1 month ago by petkov
Modified:
9 years, 7 months ago
Reviewers:
adlr
CC:
chromium-os-reviews_chromium.org, petkov, adlr
Visibility:
Public.

Description

AU: Nice for 2 hours, then normal priority. The intent is to improve system responsiveness during an update. BUG=8182 TEST=unit tests; tested on device while watching video and having two gmail tabs open -- update completed in about 10 minutes. Change-Id: I2a04a136cedd703260aa53e24d9358bdbbe007fa Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=f622ef7

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -16 lines) Patch
M update_attempter.h View 1 chunk +3 lines, -6 lines 0 comments Download
M update_attempter.cc View 2 chunks +3 lines, -10 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
petkov
10 years, 1 month ago (2010-10-26 20:29:08 UTC) #1
adlr
10 years, 1 month ago (2010-10-26 20:45:49 UTC) #2
LGTM

On Tue, Oct 26, 2010 at 1:29 PM, <petkov@chromium.org> wrote:

> Reviewers: adlr,
>
> Description:
> AU: Nice for 2 hours, then normal priority.
>
> The intent is to improve system responsiveness during an update.
>
> BUG=8182
> TEST=unit tests; tested on device while watching video and having
> two gmail tabs open -- update completed in about 10 minutes.
>
> Change-Id: I2a04a136cedd703260aa53e24d9358bdbbe007fa
>
> Please review this at http://codereview.chromium.org/4191002/show
>
> SVN Base: ssh://git@gitrw.chromium.org:9222/update_engine.git
>
> Affected files:
>  M update_attempter.h
>  M update_attempter.cc
>
>
> Index: update_attempter.cc
> diff --git a/update_attempter.cc b/update_attempter.cc
> index
>
7c324755aa328e3c97f108c637ca086ed65572f8..5b7f9883a758474848772f8a6c5cf13dc28d82b6
> 100644
> --- a/update_attempter.cc
> +++ b/update_attempter.cc
> @@ -472,7 +472,7 @@ void UpdateAttempter::SetupPriorityManagement() {
>     LOG(ERROR) << "Process priority timeout source hasn't been destroyed.";
>     CleanupPriorityManagement();
>   }
> -  const int kPriorityTimeout = 10 * 60;  // 10 minutes
> +  const int kPriorityTimeout = 2 * 60 * 60;  // 2 hours
>   manage_priority_source_ = g_timeout_source_new_seconds(kPriorityTimeout);
>   g_source_set_callback(manage_priority_source_,
>                         StaticManagePriorityCallback,
> @@ -495,16 +495,9 @@ gboolean
> UpdateAttempter::StaticManagePriorityCallback(gpointer data) {
>  }
>
>  bool UpdateAttempter::ManagePriorityCallback() {
> -  // If the current process priority is below normal, set it to normal
> -  // and let GLib invoke this callback again.
> -  if (utils::ComparePriorities(priority_, utils::kProcessPriorityNormal) <
> 0) {
> -    SetPriority(utils::kProcessPriorityNormal);
> -    return true;
> -  }
> -  // Set the priority to high and let GLib destroy the timeout source.
> -  SetPriority(utils::kProcessPriorityHigh);
> +  SetPriority(utils::kProcessPriorityNormal);
>   manage_priority_source_ = NULL;
> -  return false;
> +  return false;  // Destroy the timeout source.
>  }
>
>  void UpdateAttempter::DisableDeltaUpdateIfNeeded() {
> Index: update_attempter.h
> diff --git a/update_attempter.h b/update_attempter.h
> index
>
db05c7b43f359d3bc607bf61634fabdf369dbfb8..3a4ff49960b1b2bbc98a007b2b50d7e2fc4caa3a
> 100644
> --- a/update_attempter.h
> +++ b/update_attempter.h
> @@ -134,18 +134,15 @@ class UpdateAttempter : public
> ActionProcessorDelegate,
>   // returns.
>   void SetPriority(utils::ProcessPriority priority);
>
> -  // Set the process priority to low and sets up timeout events to
> increase the
> -  // priority gradually to high.
> +  // Sets the process priority to low and sets up timeout events to
> increase it.
>   void SetupPriorityManagement();
>
>   // Resets the process priority to normal and destroys any scheduled
> timeout
>   // sources.
>   void CleanupPriorityManagement();
>
> -  // The process priority timeout source callback increases the current
> priority
> -  // by one step (low goes to normal, normal goes to high). Returns true
> if the
> -  // callback must be invoked again after a timeout, or false if GLib can
> -  // destroy this timeout source.
> +  // The process priority timeout source callback sets the current
> priority to
> +  // normal. Returns false so that GLib destroys the timeout source.
>   static gboolean StaticManagePriorityCallback(gpointer data);
>   bool ManagePriorityCallback();
>
>
>
>

Powered by Google App Engine
This is Rietveld 408576698