7.0-rc1 (revision v7.0-rc1)
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, 2016-2017,
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 Topology macros
1187
* ****************************************************************************/
1188
1286
/* **************************************************************************************
1287
* User Topology macros
1288
* *************************************************************************************/
1289
#ifdef SCOREP_USER_ENABLE
1290
1291
#define SCOREP_USER_CARTESIAN_TOPOLOGY_CREATE( userTopology, name, nDims ) \
1292
SCOREP_User_CartesianTopologyHandle userTopology = SCOREP_USER_INVALID_CARTESIAN_TOPOLOGY; \
1293
SCOREP_User_CartTopologyCreate( &userTopology, name, nDims );
1294
1295
#define SCOREP_USER_CARTESIAN_TOPOLOGY_ADD_DIM( userTopology, size, periodic, name ) \
1296
SCOREP_User_CartTopologyAddDim( userTopology, size, periodic, name );
1297
1298
#define SCOREP_USER_CARTESIAN_TOPOLOGY_INIT( userTopology ) \
1299
SCOREP_User_CartTopologyInit( userTopology );
1300
1301
#define SCOREP_USER_CARTESIAN_TOPOLOGY_SET_COORDS( userTopology, nDims, ... ) \
1302
SCOREP_User_CartTopologySetCoords( userTopology, nDims, __VA_ARGS__ );
1303
1304
#endif // SCOREP_USER_ENABLE
1305
1306
//just for doxygen completeness in Fortran case.
1307
#define SCOREP_USER_CARTESIAN_TOPOLOGY_DEFINE( userTopology )
1308
1309
/* **************************************************************************************
1310
* Documentation for C++ specific macros
1311
* *************************************************************************************/
1312
1344
/* **************************************************************************************
1345
* C++ specific macros
1346
* *************************************************************************************/
1347
#ifdef SCOREP_USER_ENABLE
1348
1349
#ifdef __cplusplus
1350
1351
/* We want to initialize the region handle only once and store it in a static variable.
1352
Thus, if the region is revisited, we do not need to evaluate filters and check double
1353
definitions. However, we want the region object reconstruct every time to execute
1354
the enter/exit in the constructor/destructor. The region handle in the class is
1355
necessary to pass the region handle from the constructor to the destructor. */
1356
#define SCOREP_USER_REGION( name, type ) static SCOREP_User_RegionHandle \
1357
scorep_user_region_handle = SCOREP_USER_INVALID_REGION; \
1358
SCOREP_User_RegionClass \
1359
scorep_user_region_inst( &scorep_user_region_handle, \
1360
name, \
1361
type, \
1362
&SCOREP_User_LastFileName, \
1363
&SCOREP_User_LastFileHandle, \
1364
__FILE__, __LINE__ );
1365
1366
#else // __cplusplus
1367
1368
#define SCOREP_USER_REGION( name, type )
1369
1370
#endif // __cplusplus
1371
1372
#endif // SCOREP_USER_ENABLE
1373
1374
/* **************************************************************************************
1375
* Documentation for Control macros
1376
* *************************************************************************************/
1377
1481
/* **************************************************************************************
1482
* Control macros
1483
* *************************************************************************************/
1484
1485
#ifdef SCOREP_USER_ENABLE
1486
1487
#define SCOREP_RECORDING_ON() SCOREP_User_EnableRecording();
1488
1489
#define SCOREP_RECORDING_OFF() SCOREP_User_DisableRecording();
1490
1491
#define SCOREP_RECORDING_IS_ON() SCOREP_User_RecordingEnabled()
1492
1493
#else // SCOREP_USER_ENABLE
1494
1495
/* **************************************************************************************
1496
* Empty macros, if user instrumentation is disabled
1497
* *************************************************************************************/
1498
1499
#define SCOREP_USER_REGION( name, type )
1500
#define SCOREP_USER_REGION_DEFINE( handle )
1501
#define SCOREP_USER_REWIND_DEFINE( handle )
1502
#define SCOREP_USER_OA_PHASE_BEGIN( handle, name, type )
1503
#define SCOREP_USER_OA_PHASE_END( handle )
1504
#define SCOREP_USER_REWIND_POINT( handle, name )
1505
#define SCOREP_USER_REGION_BEGIN( handle, name, type )
1506
#define SCOREP_USER_REGION_BY_NAME_BEGIN( name, type )
1507
#define SCOREP_USER_REGION_INIT( handle, name, type )
1508
#define SCOREP_USER_REGION_END( handle )
1509
#define SCOREP_USER_REGION_BY_NAME_END( name )
1510
#define SCOREP_USER_REWIND_CHECK( handle, value )
1511
#define SCOREP_USER_REGION_ENTER( handle )
1512
#define SCOREP_USER_FUNC_BEGIN()
1513
#define SCOREP_USER_FUNC_END()
1514
#define SCOREP_USER_GLOBAL_REGION_DEFINE( handle )
1515
#define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle )
1516
#define SCOREP_USER_PARAMETER_INT64( name, value )
1517
#define SCOREP_USER_PARAMETER_UINT64( name, value )
1518
#define SCOREP_USER_PARAMETER_STRING( name, value )
1519
#define SCOREP_USER_METRIC_GLOBAL( metricHandle )
1520
#define SCOREP_USER_METRIC_EXTERNAL( metricHandle )
1521
#define SCOREP_USER_METRIC_LOCAL( metricHandle )
1522
#define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context )
1523
#define SCOREP_USER_METRIC_INT64( metricHandle, value )
1524
#define SCOREP_USER_METRIC_UINT64( metricHandle, value )
1525
#define SCOREP_USER_METRIC_DOUBLE( metricHandle, value )
1526
#define SCOREP_RECORDING_ON()
1527
#define SCOREP_RECORDING_OFF()
1528
#define SCOREP_RECORDING_IS_ON() 0
1529
#define SCOREP_USER_CARTESIAN_TOPOLOGY_CREATE( userTopology, name, ndims )
1530
#define SCOREP_USER_CARTESIAN_TOPOLOGY_ADD_DIM( userTopology, size, periodic, name )
1531
#define SCOREP_USER_CARTESIAN_TOPOLOGY_INIT( userTopology )
1532
#define SCOREP_USER_CARTESIAN_TOPOLOGY_SET_COORDS( userTopology, nDims, ... )
1533
1534
#endif // SCOREP_USER_ENABLE
1535
1538
#endif
/* SCOREP_USER_H */
Report bugs to
support@score-p.org