• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "base/profiler.h"
6 #include "base/string_util.h"
7 
8 // When actually using quantify, uncomment the following line.
9 // #define QUANTIFY
10 
11 #ifdef QUANTIFY
12 // this #define is used to prevent people from directly using pure.h
13 // instead of profiler.h
14 #define PURIFY_PRIVATE_INCLUDE
15 #include "base/third_party/purify/pure.h"
16 #endif // QUANTIFY
17 
18 namespace base {
19 
StartRecording()20 void Profiler::StartRecording() {
21 #ifdef QUANTIFY
22   QuantifyStartRecordingData();
23 #endif
24 }
25 
StopRecording()26 void Profiler::StopRecording() {
27 #ifdef QUANTIFY
28   QuantifyStopRecordingData();
29 #endif
30 }
31 
ClearData()32 void Profiler::ClearData() {
33 #ifdef QUANTIFY
34   QuantifyClearData();
35 #endif
36 }
37 
SetThreadName(const char * name)38 void Profiler::SetThreadName(const char *name) {
39 #ifdef QUANTIFY
40   // make a copy since the Quantify function takes a char*, not const char*
41   char buffer[512];
42   base::snprintf(buffer, sizeof(buffer)-1, "%s", name);
43   QuantifySetThreadName(buffer);
44 #endif
45 }
46 
47 }  // namespace base
48