summaryrefslogtreecommitdiff
path: root/chromium/services/resource_coordinator
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/services/resource_coordinator
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/services/resource_coordinator')
-rw-r--r--chromium/services/resource_coordinator/memory_instrumentation/graph.h6
-rw-r--r--chromium/services/resource_coordinator/memory_instrumentation/graph_processor.h6
-rw-r--r--chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h31
-rw-r--r--chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc7
4 files changed, 39 insertions, 11 deletions
diff --git a/chromium/services/resource_coordinator/memory_instrumentation/graph.h b/chromium/services/resource_coordinator/memory_instrumentation/graph.h
index a85dc515c5c..5b0251728bd 100644
--- a/chromium/services/resource_coordinator/memory_instrumentation/graph.h
+++ b/chromium/services/resource_coordinator/memory_instrumentation/graph.h
@@ -2,6 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// This file is being migrated to the //third_party/perfetto repository
+// as part of the plan in http://crbug.com/1095982. Until the migration
+// is finished, there will be two copies around. Contact
+// mobica-google-contributors@mobica.com if you feel you need to make
+// non-trivial changes to this file.
+
#ifndef SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_H_
#define SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_H_
diff --git a/chromium/services/resource_coordinator/memory_instrumentation/graph_processor.h b/chromium/services/resource_coordinator/memory_instrumentation/graph_processor.h
index 1cf7252b324..2ef6d3b559d 100644
--- a/chromium/services/resource_coordinator/memory_instrumentation/graph_processor.h
+++ b/chromium/services/resource_coordinator/memory_instrumentation/graph_processor.h
@@ -2,6 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// This file is being migrated to the //third_party/perfetto repository
+// as part of the plan in http://crbug.com/1095982. Until the migration
+// is finished, there will be two copies around. Contact
+// mobica-google-contributors@mobica.com if you feel you need to make
+// non-trivial changes to this file.
+
#ifndef SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_PROCESSOR_H_
#define SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_PROCESSOR_H_
diff --git a/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h b/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h
index 58944b0c534..1e95e345556 100644
--- a/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h
+++ b/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h
@@ -45,21 +45,32 @@ class COMPONENT_EXPORT(
#endif
#if defined(OS_LINUX) || defined(OS_ANDROID)
- // Provides information on the dump state of resident pages.
+ // Provides information on the dump state of resident pages. These values are
+ // written to logs. New enum values can be added, but existing enums must
+ // never be renumbered or deleted and reused.
enum class MappedAndResidentPagesDumpState {
// Access to /proc/<pid>/pagemap can be denied for android devices running
// a kernel version < 4.4.
- kAccessPagemapDenied,
- kFailure,
- kSuccess
+ kAccessPagemapDenied = 0,
+ kFailure = 1,
+ kSuccess = 2,
+
+ // Must be equal to the greatest among enumeraiton values.
+ kMaxValue = kSuccess
};
- // Depends on /proc/self/pagemap to determine mapped and resident pages
- // within bounds (start_address inclusive and end_address exclusive).
- // It does not use mincore() because it only checks to see
- // if the page is in the cache and up to date.
- // mincore() has no guarantee a page has been mapped by the current process.
- // Guaranteed to work on Android.
+ // Fills out a bitmap of memory pages accessed by the current process that are
+ // still in pagecache.
+ //
+ // Depends on /proc/self/pagemap to determine the mapped and resident pages
+ // within bounds (|start_address| inclusive and |end_address| exclusive).
+ //
+ // Does not use mincore() because the latter only reports resident pages. The
+ // mincore() would report a page as resident if that page was accessed from a
+ // different process (such as the commonly used prefetch of the native
+ // library).
+ //
+ // Tested only on Android.
static MappedAndResidentPagesDumpState GetMappedAndResidentPages(
const size_t start_address,
const size_t end_address,
diff --git a/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc b/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc
index 1eabb897893..c3af87bba04 100644
--- a/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc
+++ b/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc
@@ -14,6 +14,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/format_macros.h"
+#include "base/metrics/histogram_macros.h"
#include "base/process/process_metrics.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -280,9 +281,13 @@ bool OSMetrics::FillOSMemoryDump(base::ProcessId pid,
OSMetrics::GetMappedAndResidentPages(base::android::kStartOfText,
base::android::kEndOfText,
&accessed_pages_bitmap);
+ UMA_HISTOGRAM_ENUMERATION(
+ "Memory.NativeLibrary.MappedAndResidentMemoryFootprintCollectionStatus",
+ state);
// MappedAndResidentPagesDumpState |state| can be |kAccessPagemapDenied|
- // for Android devices running a kernel version < 4.4.
+ // for Android devices running a kernel version < 4.4 or because the process
+ // is not "dumpable", as described in proc(5).
if (state != OSMetrics::MappedAndResidentPagesDumpState::kSuccess)
return state != OSMetrics::MappedAndResidentPagesDumpState::kFailure;