Predator
[unstable] git snapshot
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
symdebug.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2011 Kamil Dudka <kdudka@redhat.com>
3
*
4
* This file is part of predator.
5
*
6
* predator is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* any later version.
10
*
11
* predator is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with predator. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
21
#ifndef H_GUARD_SYM_DEBUG_H
22
#define H_GUARD_SYM_DEBUG_H
23
24
#include "
symplot.hh
"
25
26
#include <iomanip>
27
#include <string>
28
#include <sstream>
29
30
#define LOCAL_DEBUG_PLOTTER(name, enabled_by_default) \
31
static bool __ldp_enabled_##name = static_cast<bool>(enabled_by_default); \
32
static int __ldp_cnt_total_##name = -1; \
33
static int __ldp_cnt_steps_##name; \
34
static std::string __ldp_plot_name_##name; \
35
\
36
void __ldp_enable_##name() { \
37
::__ldp_enabled_##name = true; \
38
} \
39
\
40
void __ldp_disable_##name() { \
41
::__ldp_enabled_##name = false; \
42
} \
43
\
44
void __ldp_init_##name(std::string plot_name) { \
45
++::__ldp_cnt_total_##name; \
46
::__ldp_cnt_steps_##name = 0; \
47
::__ldp_plot_name_##name = plot_name; \
48
} \
49
\
50
void __ldp_plot_##name(const SymHeap &sh, std::string *pName = 0) { \
51
if (!::__ldp_enabled_##name) \
52
return; \
53
\
54
std::ostringstream str; \
55
\
56
str << #name "-" << std::setfill('0') << std::setw(4) \
57
<< ::__ldp_cnt_total_##name \
58
<< "-" << ::__ldp_plot_name_##name \
59
<< "-" << std::setfill('0') << std::setw(4) \
60
<< (::__ldp_cnt_steps_##name++); \
61
\
62
plotHeap(sh, str.str().c_str(),
/* loc */
0, pName); \
63
} \
64
65
#define LDP_INIT(plotter, plot_name) __ldp_init_##plotter(plot_name)
66
#define LDP_PLOT(plotter, sh) __ldp_plot_##plotter(sh)
67
#define LDP_PLOTN(plotter, sh, pName)__ldp_plot_##plotter(sh, pName)
68
#define LDP_ENABLE(plotter) __ldp_enable_##plotter()
69
#define LDP_DISABLE(plotter) __ldp_disable_##plotter()
70
71
#endif
/* H_GUARD_SYM_DEBUG_H */
Generated on Mon Nov 9 2015 14:51:59 for Predator by
1.8.1.2