1 // Copyright (c) 2011 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 #ifndef BASE_DEBUG_PROFILER_H 6 #define BASE_DEBUG_PROFILER_H 7 #pragma once 8 9 #include <string> 10 11 // The Profiler functions allow usage of the underlying sampling based 12 // profiler. If the application has not been built with the necessary 13 // flags (-DENABLE_PROFILING and not -DNO_TCMALLOC) then these functions 14 // are noops. 15 namespace base { 16 namespace debug { 17 18 // Start profiling with the supplied name. 19 // {pid} will be replaced by the process' pid and {count} will be replaced 20 // by the count of the profile run (starts at 1 with each process). 21 void StartProfiling(const std::string& name); 22 23 // Stop profiling and write out data. 24 void StopProfiling(); 25 26 // Force data to be written to file. 27 void FlushProfiling(); 28 29 // Returns true if process is being profiled. 30 bool BeingProfiled(); 31 32 } // namespace debug 33 } // namespace base 34 35 #endif // BASE_DEBUG_DEBUGGER_H 36