profiler.h Source File

CPP API: profiler.h Source File
profiler.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Daniel Abele
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 
21 #ifndef MIO_UTILS_PROFILER_H
22 #define MIO_UTILS_PROFILER_H
23 
24 #include "memilio/config.h"
25 
26 #ifdef MEMILIO_ENABLE_PROFILING
27 
28 #include "gperftools/profiler.h"
29 
36 #define MEMILIO_PROFILER_START(file) ProfilerStart(file)
37 
41 #define MEMILIO_PROFILER_STOP() ProfilerStop()
42 
43 #else //MEMILIO_ENABLE_PROFILING
44 
45 //empty definitions so the macros can remain in the code if profiling is disabled.
46 #define MEMILIO_PROFILER_START(file)
47 #define MEMILIO_PROFILER_STOP()
48 
49 #endif //MEMILIO_ENABLE_PROFILING
50 
51 #endif //MIO_UTILS_PROFILER_H