/tomo/pyhst

To get this branch, use:
bzr branch http://darksoft.org/webbzr/tomo/pyhst
28 by csa
Use pinned result buffer to perform device2host memory transfer parallel with computations, add ESRF copyright information in files appeared after redesign
1
/*
78 by Suren A. Chilingaryan
Add COPYING and fix license statements
2
 * The PyHST program is Copyright (C) 2002-2011 of the
3
 * European Synchrotron Radiation Facility (ESRF) and
4
 * Karlsruhe Institute of Technology (KIT).
28 by csa
Use pinned result buffer to perform device2host memory transfer parallel with computations, add ESRF copyright information in files appeared after redesign
5
 *
6
 * PyHST is free software: you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License as published by the
8
 * Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 * 
11
 * hst is distributed in the hope that it will be useful, but
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 * See the GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License along
17
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
7 by csa
more consistent logging
20
#ifndef _PYHST_DEBUG_H
21
#define _PYHST_DEBUG_H
22
23
#include <glib.h>
24
25
#define pyhst_log(log_levels, module, err, ...) \
26
    _ds_log_message(0, G_LOG_DOMAIN, log_levels,  (log_levels&DS_LOG_FATAL_MESSAGE)?__FILE__:NULL, __func__, __LINE__, NULL, module, NULL, NULL, err, __VA_ARGS__)
27
28
#define pyhst_custom_log(condition, log_levels, module, prefix, err, ...) \
29
    _ds_log_message(condition, G_LOG_DOMAIN, log_levels, (log_levels&DS_LOG_FATAL_MESSAGE)?__FILE__:NULL, __func__, __LINE__, NULL, module, NULL, prefix, err, __VA_ARGS__)
30
31
#define pyhst_debug(...) pyhst_log(G_LOG_LEVEL_DEBUG, NULL, 0, __VA_ARGS__)
32
#define pyhst_info(...) pyhst_log(G_LOG_LEVEL_INFO, NULL, 0, __VA_ARGS__)
33
#define pyhst_warning(...) pyhst_log(G_LOG_LEVEL_WARNING, NULL, 0, __VA_ARGS__)
34
#define pyhst_error(...) pyhst_log(G_LOG_LEVEL_CRITICAL, NULL, 0, __VA_ARGS__)
23 by csa
Perform pair of convolutions using a single complex fourier transformation in CUDA reconstruction module (early commit)
35
#define pyhst_fail(...) pyhst_log((GLogLevelFlags)(G_LOG_LEVEL_ERROR|DS_LOG_FATAL_MESSAGE), NULL, 0, __VA_ARGS__)
7 by csa
more consistent logging
36
37
#define pyhst_debug_module(mod, ...) pyhst_log(G_LOG_LEVEL_DEBUG, mod, 0, __VA_ARGS__)
38
39
#define MESSAGE(s) pyhst_debug_module("C_HST_RECON_OVERSLICES", s)
40
#define DEBUG(s) pyhst_debug(s);
25 by csa
Apply fai360 limits in blocks (hst_gpu)
41
#define check_alloc(ptr, ...) pyhst_custom_log((ptr != NULL), (GLogLevelFlags)(G_LOG_LEVEL_ERROR|DS_LOG_FATAL_MESSAGE), NULL, "failed allocations of array %s", 0, __VA_ARGS__)
42
#define check_code(code, ...) pyhst_custom_log((code == 0), (GLogLevelFlags)(G_LOG_LEVEL_ERROR|DS_LOG_FATAL_MESSAGE), NULL, "error %u during execution of function %s", code, __VA_ARGS__)
7 by csa
more consistent logging
43
22 by csa
Timing reporting, few bug fixes
44
#ifdef __cplusplus
45
extern "C" {
46
#endif
47
7 by csa
more consistent logging
48
int pyhst_configure_logger(int log_level, GLogFunc handler, gpointer arg);
49
50
/**
51
  * Pushes message into the glib log file, this is maximal function which is
52
  * expected to be called from various define macroses
53
  *
54
  * @param condition is message is shown only if condition is false
55
  * @param log_domain is the log domain, usually G_LOG_DOMAIN
56
  * @param log_level is the log level, either from GLogLevelFlags or a user-defined level, may indicate fatality
57
  * @param file is source file where the event have occured
58
  * @param func is function name where the event have occured
59
  * @param line is source line where the event have occured
60
  * @param service is the type of service which haev produced the event
61
  * @param module is the type of module which have produced the event
62
  * @param ptr is the object which have produced the event
63
  * @param prefix is a message enclosing err and message (%s replaced with message and %iud... with error code)
64
  * @param err is error code (0 - not an error, -1 - from errno)
65
  * @param format is the message format. See the printf() documentation
66
  */
188 by Suren A. Chilingaryan
NewTex kernel
67
void _ds_log_message(int condition, const gchar *log_domain, GLogLevelFlags log_levels, const char *file, const char *func, int line, const gchar *service, const gchar *module, void *ptr, const gchar *prefix, int err, const gchar *format, ...);
7 by csa
more consistent logging
68
69
70
#define ds_log_message(condition, log_domain, log_levels, service, module, addr, prefix, err, ...) \
71
    _ds_log_message(condition, log_domain, log_levels, __FILE__, __func__, __LINE__, service, module, addr, prefix, err, __VA_ARGS__)
72
73
/** Terminate application after printing message */
74
#define DS_LOG_FATAL_MESSAGE G_LOG_FLAG_FATAL
75
/** Free memory occupied by message if prefix is undefined or prefix otherwise */
76
#define DS_LOG_CLEAN_MESSAGE G_LOG_FLAG_RECURSION
77
/** Mask for selecting all levels */
78
#define DS_LOG_LEVEL_MASK G_LOG_LEVEL_MASK
79
80
/** Set required logger output and logging details (for all domains)
81
  * 
82
  * @param log_level - maximal log detail
83
  * @param sink - currently unsupported
84
  */
85
void ds_configure_logger(GLogLevelFlags log_level, const char *sink);
86
87
/** Set required logging details (for all domains)
88
  * 
89
  * @param log_level - maximal log detail
90
  */
91
void ds_log_set_level(GLogLevelFlags log_level);
92
93
/** Switches on logging message timestmaps */
49 by root
Merge /home/matthias/dev/pyHST
94
void ds_log_enable_timestamps(void);
7 by csa
more consistent logging
95
96
/** Switches on logging threading information */
49 by root
Merge /home/matthias/dev/pyHST
97
void ds_log_enable_threads(void);
7 by csa
more consistent logging
98
59 by Suren A. Chilingaryan
Properly support multiple OpenCL platforms
99
/** Returns non zero if logging is enabled for specified level */
100
int ds_log_check_level(GLogLevelFlags log_level);
101
102
22 by csa
Timing reporting, few bug fixes
103
# ifdef __cplusplus
104
}
105
# endif
106
7 by csa
more consistent logging
107
#endif /* _PYHST_DEBUG_H */