IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
Profiler.h
Go to the documentation of this file.
1 /**
2  * \file IMP/benchmark/Profiler.h
3  * \brief Various utilities for benchmarking
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPBENCHMARK_PROFILER_H
10 #define IMPBENCHMARK_PROFILER_H
11 
12 #include <IMP/benchmark/benchmark_config.h>
13 #include <IMP/raii_macros.h>
14 #include <string>
15 
16 IMPBENCHMARK_BEGIN_NAMESPACE
17 
18 /** One can use the
19  [GPerfTools profiler](https://github.com/gperftools/gperftools)
20  to profile code. On a Mac, you should
21  use the Instruments program instead (part of the Mac OS X Developer Tools).
22 */
23 class IMPBENCHMARKEXPORT Profiler : public RAII {
24  void start(std::string name);
25  void stop();
26 
27  public:
28  IMP_RAII(Profiler, (std::string name), , start(name), stop(),
29  out << "profiling");
30 };
31 
32 IMPBENCHMARK_END_NAMESPACE
33 
34 #endif /* IMPBENCHMARK_PROFILER_H */
Temporarily change something; undo the change when this object is destroyed.
Definition: RAII.h:28
#define IMP_RAII(Name, args, Initialize, Set, Reset, Show)
Declares RAII-style methods in a class.
Definition: raii_macros.h:34
Macros to aid in writing RAII-style classes.