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

Side by Side Diff: base/debug/profiler.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.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
« no previous file with comments | « base/debug/crash_logging.cc ('k') | base/debug/stack_trace_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/debug/profiler.h" 5 #include "base/debug/profiler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/process/process_handle.h" 9 #include "base/process/process_handle.h"
10 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h"
12 12
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include "base/win/pe_image.h" 14 #include "base/win/pe_image.h"
15 #endif // defined(OS_WIN) 15 #endif // defined(OS_WIN)
16 16
17 // TODO(peria): Enable profiling on Windows. 17 // TODO(peria): Enable profiling on Windows.
18 #if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN) 18 #if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
19 #include "third_party/tcmalloc/chromium/src/gperftools/profiler.h" 19 #include "third_party/tcmalloc/chromium/src/gperftools/profiler.h"
20 #endif 20 #endif
21 21
22 namespace base { 22 namespace base {
23 namespace debug { 23 namespace debug {
24 24
25 // TODO(peria): Enable profiling on Windows. 25 // TODO(peria): Enable profiling on Windows.
26 #if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN) 26 #if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
27 27
28 static int profile_count = 0; 28 static int profile_count = 0;
29 29
30 void StartProfiling(const std::string& name) { 30 void StartProfiling(const std::string& name) {
31 ++profile_count; 31 ++profile_count;
32 std::string full_name(name); 32 std::string full_name(name);
33 std::string pid = StringPrintf("%d", GetCurrentProcId()); 33 std::string pid = IntToString(GetCurrentProcId());
34 std::string count = StringPrintf("%d", profile_count); 34 std::string count = IntToString(profile_count);
35 ReplaceSubstringsAfterOffset(&full_name, 0, "{pid}", pid); 35 ReplaceSubstringsAfterOffset(&full_name, 0, "{pid}", pid);
36 ReplaceSubstringsAfterOffset(&full_name, 0, "{count}", count); 36 ReplaceSubstringsAfterOffset(&full_name, 0, "{count}", count);
37 ProfilerStart(full_name.c_str()); 37 ProfilerStart(full_name.c_str());
38 } 38 }
39 39
40 void StopProfiling() { 40 void StopProfiling() {
41 ProfilerFlush(); 41 ProfilerFlush();
42 ProfilerStop(); 42 ProfilerStop();
43 } 43 }
44 44
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 MoveDynamicSymbol GetProfilerMoveDynamicSymbolFunc() { 211 MoveDynamicSymbol GetProfilerMoveDynamicSymbolFunc() {
212 return FindFunctionInImports<MoveDynamicSymbol>( 212 return FindFunctionInImports<MoveDynamicSymbol>(
213 "MoveDynamicSymbol"); 213 "MoveDynamicSymbol");
214 } 214 }
215 215
216 #endif // defined(OS_WIN) 216 #endif // defined(OS_WIN)
217 217
218 } // namespace debug 218 } // namespace debug
219 } // namespace base 219 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/crash_logging.cc ('k') | base/debug/stack_trace_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698