5.0-trunk (revision 14705)
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
include
scorep
SCOREP_User.h
Go to the documentation of this file.
1
/*
2
* This file is part of the Score-P software (http://www.score-p.org)
3
*
4
* Copyright (c) 2009-2011,
5
* RWTH Aachen University, Germany
6
*
7
* Copyright (c) 2009-2011,
8
* Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
9
*
10
* Copyright (c) 2009-2011, 2014-2015,
11
* Technische Universitaet Dresden, Germany
12
*
13
* Copyright (c) 2009-2011,
14
* University of Oregon, Eugene, USA
15
*
16
* Copyright (c) 2009-2011, 2013-2014,
17
* Forschungszentrum Juelich GmbH, Germany
18
*
19
* Copyright (c) 2009-2011, 2014-2015,
20
* German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
21
*
22
* Copyright (c) 2009-2011,
23
* Technische Universitaet Muenchen, Germany
24
*
25
* This software may be modified and distributed under the terms of
26
* a BSD-style license. See the COPYING file in the package base
27
* directory for details.
28
*
29
*/
30
31
#ifndef SCOREP_USER_H
32
#define SCOREP_USER_H
33
41
/* Guarded because it declares variables in every file where it is included. */
42
#ifdef SCOREP_USER_ENABLE
43
#include <scorep/SCOREP_User_Variables.h>
44
#include <scorep/SCOREP_User_Functions.h>
45
#endif
46
47
/* Provide macro SCOREP_USER_FUNCTION_NAME that expands to the
48
* function name of the enclosing function. */
49
#ifndef SCOREP_USER_FUNCTION_NAME
50
#if defined( __cplusplus ) && defined( __FUJITSU )
51
#define SCOREP_USER_FUNCTION_NAME __FUNCTION__
52
#else
53
#define SCOREP_USER_FUNCTION_NAME __func__
54
#endif
55
#endif
56
88
/* **************************************************************************************
89
* Documentation for region enclosing macros
90
* *************************************************************************************/
91
637
/* **************************************************************************************
638
* Region enclosing macros
639
* *************************************************************************************/
640
/* Empty define for SCOREP_USER_FUNC_DEFINE to allow documentation of the macro and
641
let it disappear in C/C++ codes */
642
#define SCOREP_USER_FUNC_DEFINE()
643
644
#ifdef SCOREP_USER_ENABLE
645
646
#define SCOREP_USER_OA_PHASE_BEGIN( handle, name, type ) SCOREP_User_OaPhaseBegin( \
647
&handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \
648
type, __FILE__, __LINE__ );
649
650
#define SCOREP_USER_OA_PHASE_END( handle ) \
651
SCOREP_User_OaPhaseEnd( handle );
652
653
#define SCOREP_USER_REGION_DEFINE( handle ) \
654
static SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION;
655
656
#define SCOREP_USER_REGION_ENTER( handle ) SCOREP_User_RegionEnter( handle );
657
658
#define SCOREP_USER_REGION_BEGIN( handle, name, type ) SCOREP_User_RegionBegin( \
659
&handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \
660
type, __FILE__, __LINE__ );
661
662
#define SCOREP_USER_REGION_INIT( handle, name, type ) SCOREP_User_RegionInit( \
663
&handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \
664
type, __FILE__, __LINE__ );
665
666
#define SCOREP_USER_REGION_END( handle ) SCOREP_User_RegionEnd( handle );
667
668
/* automatic, name tagged region begin */
669
#define SCOREP_USER_REGION_BY_NAME_BEGIN( name, type ) SCOREP_User_RegionByNameBegin( \
670
name, type, "", 0 );
671
672
/* automatic, name tagged region end */
673
#define SCOREP_USER_REGION_BY_NAME_END( name ) SCOREP_User_RegionByNameEnd( name );
674
675
#define SCOREP_USER_REWIND_DEFINE( handle ) \
676
static SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION;
677
678
#define SCOREP_USER_REWIND_POINT( handle, name ) \
679
SCOREP_User_RewindRegionBegin( &handle, &SCOREP_User_LastFileName, \
680
&SCOREP_User_LastFileHandle, name, \
681
SCOREP_USER_REGION_TYPE_COMMON, __FILE__, __LINE__ );
682
683
#define SCOREP_USER_REWIND_CHECK( handle, value ) \
684
SCOREP_User_RewindRegionEnd( handle, value );
685
686
#define SCOREP_USER_FUNC_BEGIN() static SCOREP_User_RegionHandle \
687
scorep_user_func_handle = SCOREP_USER_INVALID_REGION; \
688
SCOREP_User_RegionBegin( &scorep_user_func_handle, &SCOREP_User_LastFileName, \
689
&SCOREP_User_LastFileHandle, SCOREP_USER_FUNCTION_NAME, \
690
SCOREP_USER_REGION_TYPE_FUNCTION, __FILE__, __LINE__ );
691
692
#define SCOREP_USER_FUNC_END() SCOREP_User_RegionEnd( scorep_user_func_handle );
693
694
#define SCOREP_USER_GLOBAL_REGION_DEFINE( handle ) \
695
SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION;
696
697
#define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle ) \
698
extern SCOREP_User_RegionHandle handle;
699
700
#endif // SCOREP_USER_ENABLE
701
702
/* **************************************************************************************
703
* Documentation for Parameter macros
704
* *************************************************************************************/
705
799
/* **************************************************************************************
800
* Parameter macros
801
* *************************************************************************************/
802
#ifdef SCOREP_USER_ENABLE
803
804
#define SCOREP_USER_PARAMETER_INT64( name, value ) { \
805
static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \
806
SCOREP_User_ParameterInt64( &scorep_param, name, value ); }
807
808
#define SCOREP_USER_PARAMETER_UINT64( name, value ) { \
809
static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \
810
SCOREP_User_ParameterUint64( &scorep_param, name, value ); }
811
812
#define SCOREP_USER_PARAMETER_STRING( name, value ) { \
813
static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \
814
SCOREP_User_ParameterString( &scorep_param, name, value ); }
815
816
#endif // SCOREP_USER_ENABLE
817
818
/* **************************************************************************************
819
* Documentation for User Metric macros
820
* *************************************************************************************/
821
1153
/* **************************************************************************************
1154
* User Counter macros
1155
* *************************************************************************************/
1156
#ifdef SCOREP_USER_ENABLE
1157
1158
#define SCOREP_USER_METRIC_LOCAL( metricHandle ) static SCOREP_SamplingSetHandle \
1159
metricHandle \
1160
= SCOREP_INVALID_SAMPLING_SET;
1161
1162
#define SCOREP_USER_METRIC_GLOBAL( metricHandle ) SCOREP_SamplingSetHandle metricHandle \
1163
= SCOREP_INVALID_SAMPLING_SET;
1164
1165
#define SCOREP_USER_METRIC_EXTERNAL( metricHandle ) \
1166
extern SCOREP_SamplingSetHandle metricHandle;
1167
1168
#define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context ) \
1169
SCOREP_User_InitMetric( &metricHandle, name, unit, type, context );
1170
1171
#define SCOREP_USER_METRIC_INT64( metricHandle, \
1172
value ) SCOREP_User_TriggerMetricInt64( \
1173
metricHandle, value );
1174
1175
#define SCOREP_USER_METRIC_UINT64( metricHandle, \
1176
value ) SCOREP_User_TriggerMetricUint64( \
1177
metricHandle, value );
1178
1179
#define SCOREP_USER_METRIC_DOUBLE( metricHandle, \
1180
value ) SCOREP_User_TriggerMetricDouble( \
1181
metricHandle, value );
1182
1183
#endif // SCOREP_USER_ENABLE
1184
1185
/* **************************************************************************************
1186
* Documentation for C++ specific macros
1187
* *************************************************************************************/
1188
1220
/* **************************************************************************************
1221
* C++ specific macros
1222
* *************************************************************************************/
1223
#ifdef SCOREP_USER_ENABLE
1224
1225
#ifdef __cplusplus
1226
1227
/* We want to initialize the region handle only once and store it in a static variable.
1228
Thus, if the region is revisited, we do not need to evaluate filters and check double
1229
definitions. However, we want the region object reconstruct every time to execute
1230
the enter/exit in the constructor/destructor. The region handle in the class is
1231
necessary to pass the region handle from the constructor to the destructor. */
1232
#define SCOREP_USER_REGION( name, type ) static SCOREP_User_RegionHandle \
1233
scorep_user_region_handle = SCOREP_USER_INVALID_REGION; \
1234
SCOREP_User_RegionClass \
1235
scorep_user_region_inst( &scorep_user_region_handle, \
1236
name, \
1237
type, \
1238
&SCOREP_User_LastFileName, \
1239
&SCOREP_User_LastFileHandle, \
1240
__FILE__, __LINE__ );
1241
1242
#else // __cplusplus
1243
1244
#define SCOREP_USER_REGION( name, type )
1245
1246
#endif // __cplusplus
1247
1248
#endif // SCOREP_USER_ENABLE
1249
1250
/* **************************************************************************************
1251
* Documentation for Control macros
1252
* *************************************************************************************/
1253
1357
/* **************************************************************************************
1358
* Control macros
1359
* *************************************************************************************/
1360
1361
#ifdef SCOREP_USER_ENABLE
1362
1363
#define SCOREP_RECORDING_ON() SCOREP_User_EnableRecording();
1364
1365
#define SCOREP_RECORDING_OFF() SCOREP_User_DisableRecording();
1366
1367
#define SCOREP_RECORDING_IS_ON() SCOREP_User_RecordingEnabled()
1368
1369
#else // SCOREP_USER_ENABLE
1370
1371
/* **************************************************************************************
1372
* Empty macros, if user instrumentation is disabled
1373
* *************************************************************************************/
1374
1375
#define SCOREP_USER_REGION( name, type )
1376
#define SCOREP_USER_REGION_DEFINE( handle )
1377
#define SCOREP_USER_REWIND_DEFINE( handle )
1378
#define SCOREP_USER_OA_PHASE_BEGIN( handle, name, type )
1379
#define SCOREP_USER_OA_PHASE_END( handle )
1380
#define SCOREP_USER_REWIND_POINT( handle, name )
1381
#define SCOREP_USER_REGION_BEGIN( handle, name, type )
1382
#define SCOREP_USER_REGION_BY_NAME_BEGIN( name, type )
1383
#define SCOREP_USER_REGION_INIT( handle, name, type )
1384
#define SCOREP_USER_REGION_END( handle )
1385
#define SCOREP_USER_REGION_BY_NAME_END( name )
1386
#define SCOREP_USER_REWIND_CHECK( handle, value )
1387
#define SCOREP_USER_REGION_ENTER( handle )
1388
#define SCOREP_USER_FUNC_BEGIN()
1389
#define SCOREP_USER_FUNC_END()
1390
#define SCOREP_USER_GLOBAL_REGION_DEFINE( handle )
1391
#define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle )
1392
#define SCOREP_USER_PARAMETER_INT64( name, value )
1393
#define SCOREP_USER_PARAMETER_UINT64( name, value )
1394
#define SCOREP_USER_PARAMETER_STRING( name, value )
1395
#define SCOREP_USER_METRIC_GLOBAL( metricHandle )
1396
#define SCOREP_USER_METRIC_EXTERNAL( metricHandle )
1397
#define SCOREP_USER_METRIC_LOCAL( metricHandle )
1398
#define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context )
1399
#define SCOREP_USER_METRIC_INT64( metricHandle, value )
1400
#define SCOREP_USER_METRIC_UINT64( metricHandle, value )
1401
#define SCOREP_USER_METRIC_DOUBLE( metricHandle, value )
1402
#define SCOREP_RECORDING_ON()
1403
#define SCOREP_RECORDING_OFF()
1404
#define SCOREP_RECORDING_IS_ON() 0
1405
1406
#endif // SCOREP_USER_ENABLE
1407
1410
#endif
/* SCOREP_USER_H */
Report bugs to
support@score-p.org