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

Unified Diff: components/tracing/common/process_metrics_memory_dump_provider_unittest.cc

Issue 2568313004: [memory-infra] Implement PollFastMemoryTotal in ProcessMetricsMemoryDumpProvider. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: components/tracing/common/process_metrics_memory_dump_provider_unittest.cc
diff --git a/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc b/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc
index 821f3c22ae49192646662241ada0768fe847efb1..9c1afb8cce88a4cab2da4e67cec032b489ae9675 100644
--- a/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc
+++ b/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc
@@ -12,6 +12,7 @@
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/process_memory_maps.h"
#include "base/trace_event/process_memory_totals.h"
+#include "base/trace_event/trace_config_memory_test_util.h"
#include "base/trace_event/trace_event_argument.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -234,4 +235,21 @@ TEST(ProcessMetricsMemoryDumpProviderTest, ParseProcSmaps) {
}
#endif // defined(OS_LINUX) || defined(OS_ANDROID)
+TEST(ProcessMetricsMemoryDumpProviderTest, TestPollFastMemoryTotal) {
+ ProcessMetricsMemoryDumpProvider mdp(base::kNullProcessId);
+ mdp.SetFastMemoryPollingEnabled(true);
+ uint64_t value;
+ for (int i = 0; i < 4; i++) {
Primiano Tucci (use gerrit) 2016/12/13 20:02:39 I think a slighly better approach would be: PollFa
ssid 2016/12/14 02:59:32 Done.
ssid 2016/12/14 06:18:58 Release builds do not make the memory resident eve
+ mdp.PollFastMemoryTotal(&value);
+ EXPECT_GT(value, 0u);
+ }
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+ EXPECT_GT(mdp.proc_statm_file_, 0);
Primiano Tucci (use gerrit) 2016/12/13 20:02:39 s/GT/GE/. In an extremely unlikely scenario, one m
ssid 2016/12/14 02:59:32 Done.
+ mdp.SetFastMemoryPollingEnabled(false);
+ EXPECT_EQ(-1, mdp.proc_statm_file_);
+#else
+ mdp.SetFastMemoryPollingEnabled(false);
+#endif
+}
+
} // namespace tracing

Powered by Google App Engine
This is Rietveld 408576698