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

Side by Side Diff: content/child/content_child_helpers.cc

Issue 1632253002: Allocator cleanup: remove CHROME_PROFILER_TIME and rotten tcmalloc deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/content_child_helpers.h" 5 #include "content/child/content_child_helpers.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/process/process_metrics.h" 11 #include "base/process/process_metrics.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
14 14
15 #if defined(OS_LINUX) 15 #if defined(OS_LINUX)
16 #include <malloc.h> 16 #include <malloc.h>
17 #endif 17 #endif
18 18
19 namespace content { 19 namespace content {
20 20
21 // TODO(primiano): get rid of this file together with --memory-metrics.
22 // This function is both misplaced and misnamed. If useful, this should
23 // be moved to base/process/process_metrics.h. Regardless the name,
24 // though, this provides only a partial and misleading value.
25 // Unfortunately some telemetry benchmark rely on it and these need to
26 // be refactored before getting rid of this. See crbug.com/581365 .
21 #if defined(OS_LINUX) || defined(OS_ANDROID) 27 #if defined(OS_LINUX) || defined(OS_ANDROID)
22 size_t GetMemoryUsageKB() { 28 size_t GetMemoryUsageKB() {
23 struct mallinfo minfo = mallinfo(); 29 struct mallinfo minfo = mallinfo();
24 uint64_t mem_usage = 30 uint64_t mem_usage =
25 #if defined(USE_TCMALLOC) 31 #if defined(USE_TCMALLOC)
26 minfo.uordblks 32 minfo.uordblks
27 #else 33 #else
28 (minfo.hblkhd + minfo.arena) 34 (minfo.hblkhd + minfo.arena)
29 #endif 35 #endif
30 >> 10; 36 >> 10;
(...skipping 18 matching lines...) Expand all
49 #else 55 #else
50 size_t GetMemoryUsageKB() { 56 size_t GetMemoryUsageKB() {
51 scoped_ptr<base::ProcessMetrics> process_metrics( 57 scoped_ptr<base::ProcessMetrics> process_metrics(
52 base::ProcessMetrics::CreateProcessMetrics( 58 base::ProcessMetrics::CreateProcessMetrics(
53 base::GetCurrentProcessHandle())); 59 base::GetCurrentProcessHandle()));
54 return process_metrics->GetPagefileUsage() >> 10; 60 return process_metrics->GetPagefileUsage() >> 10;
55 } 61 }
56 #endif 62 #endif
57 63
58 } // namespace content 64 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698