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

Side by Side Diff: chrome/browser/ui/task_manager/task_manager_table_model.cc

Issue 2314303002: Task Manager: format CPU usage with one decimal digit on all platforms (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/task_manager/task_manager_table_model.h" 5 #include "chrome/browser/ui/task_manager/task_manager_table_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/number_formatting.h" 10 #include "base/i18n/number_formatting.h"
(...skipping 15 matching lines...) Expand all
26 #include "content/public/common/result_codes.h" 26 #include "content/public/common/result_codes.h"
27 #include "third_party/WebKit/public/web/WebCache.h" 27 #include "third_party/WebKit/public/web/WebCache.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/models/table_model_observer.h" 29 #include "ui/base/models/table_model_observer.h"
30 #include "ui/base/text/bytes_formatting.h" 30 #include "ui/base/text/bytes_formatting.h"
31 31
32 namespace task_manager { 32 namespace task_manager {
33 33
34 namespace { 34 namespace {
35 35
36 const char kCpuTextFormatString[] = "%.1f";
37
36 #if defined(OS_MACOSX) 38 #if defined(OS_MACOSX)
37 // Match Activity Monitor's default refresh rate. 39 // Match Activity Monitor's default refresh rate.
38 const int64_t kRefreshTimeMS = 2000; 40 const int64_t kRefreshTimeMS = 2000;
39
40 // Activity Monitor shows %cpu with one decimal digit -- be consistent with
41 // that.
42 const char kCpuTextFormatString[] = "%.1f";
43 #else 41 #else
44 const int64_t kRefreshTimeMS = 1000; 42 const int64_t kRefreshTimeMS = 1000;
45 const char kCpuTextFormatString[] = "%.0f";
46 #endif // defined(OS_MACOSX) 43 #endif // defined(OS_MACOSX)
47 44
48 // The columns that are shared by a group will show the value of the column 45 // The columns that are shared by a group will show the value of the column
49 // only once per group. 46 // only once per group.
50 bool IsSharedByGroup(int column_id) { 47 bool IsSharedByGroup(int column_id) {
51 switch (column_id) { 48 switch (column_id) {
52 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: 49 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN:
53 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: 50 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN:
54 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: 51 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN:
55 case IDS_TASK_MANAGER_SWAPPED_MEM_COLUMN: 52 case IDS_TASK_MANAGER_SWAPPED_MEM_COLUMN:
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 832
836 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const { 833 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const {
837 if (row_index == 0) 834 if (row_index == 0)
838 return true; 835 return true;
839 836
840 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) != 837 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) !=
841 observed_task_manager()->GetProcessId(tasks_[row_index]); 838 observed_task_manager()->GetProcessId(tasks_[row_index]);
842 } 839 }
843 840
844 } // namespace task_manager 841 } // namespace task_manager
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698