OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/profiler.h" | 5 #include "base/profiler.h" |
6 #include "base/string_util.h" | |
7 | 6 |
8 #if defined(USE_TCMALLOC) && defined(OS_LINUX) | 7 #if defined(USE_TCMALLOC) && defined(OS_LINUX) |
9 #include "third_party/tcmalloc/chromium/src/google/profiler.h" | 8 #include "third_party/tcmalloc/chromium/src/google/profiler.h" |
10 #endif | 9 #endif |
11 | 10 |
12 // When actually using quantify, uncomment the following line. | 11 // When actually using quantify, uncomment the following line. |
13 // #define QUANTIFY | 12 // #define QUANTIFY |
14 | 13 |
15 #ifdef QUANTIFY | 14 #ifdef QUANTIFY |
16 // this #define is used to prevent people from directly using pure.h | 15 // this #define is used to prevent people from directly using pure.h |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void Profiler::SetThreadName(const char *name) { | 51 void Profiler::SetThreadName(const char *name) { |
53 #ifdef QUANTIFY | 52 #ifdef QUANTIFY |
54 // make a copy since the Quantify function takes a char*, not const char* | 53 // make a copy since the Quantify function takes a char*, not const char* |
55 char buffer[512]; | 54 char buffer[512]; |
56 base::snprintf(buffer, sizeof(buffer)-1, "%s", name); | 55 base::snprintf(buffer, sizeof(buffer)-1, "%s", name); |
57 QuantifySetThreadName(buffer); | 56 QuantifySetThreadName(buffer); |
58 #endif | 57 #endif |
59 } | 58 } |
60 | 59 |
61 } // namespace base | 60 } // namespace base |
OLD | NEW |