profiler.h revision 72a454cd3513ac24fbdd0e0cb9ad70b86a99b801
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. 15namespace base { 16namespace 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). 21void StartProfiling(const std::string& name); 22 23// Stop profiling and write out data. 24void StopProfiling(); 25 26// Force data to be written to file. 27void FlushProfiling(); 28 29// Returns true if process is being profiled. 30bool BeingProfiled(); 31 32} // namespace debug 33} // namespace base 34 35#endif // BASE_DEBUG_DEBUGGER_H 36