10.0 (revision 35c4bf227)
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
* SPDX-FileCopyrightText: (c) 2009 RWTH Aachen University <rwth-aachen.de>
3
* SPDX-FileCopyrightText: (c) 2009 Gesellschaft für numerische Simulation mbH Braunschweig <gns-mbh.com>
4
* SPDX-FileCopyrightText: (c) 2009 Technische Universität Dresden <tu-dresden.de>
5
* SPDX-FileCopyrightText: (c) 2009 University of Oregon <uoregon.edu>
6
* SPDX-FileCopyrightText: (c) 2009 Forschungszentrum Jülich GmbH <fz-juelich.de>
7
* SPDX-FileCopyrightText: (c) 2009 German Research School for Simulation Sciences GmbH
8
* SPDX-FileCopyrightText: (c) 2009 Technische Universität München <tum.de>
9
*
10
* SPDX-License-Identifier: BSD-3-Clause
11
*
12
*/
13
14
#ifndef SCOREP_USER_H
15
#define SCOREP_USER_H
16
24
/* Guarded because it declares variables in every file where it is included. */
25
#ifdef SCOREP_USER_ENABLE
26
#include <scorep/SCOREP_User_Variables.h>
27
#include <scorep/SCOREP_User_Functions.h>
28
#endif
29
30
/* Provide macro SCOREP_USER_FUNCTION_NAME that expands to the
31
* function name of the enclosing function. */
32
#ifndef SCOREP_USER_FUNCTION_NAME
33
#if defined( __cplusplus ) && defined( __FUJITSU )
34
#define SCOREP_USER_FUNCTION_NAME __FUNCTION__
35
#else
36
#define SCOREP_USER_FUNCTION_NAME __func__
37
#endif
38
#endif
39
71
/* **************************************************************************************
72
* Documentation for region enclosing macros
73
* *************************************************************************************/
74
506
/* **************************************************************************************
507
* Region enclosing macros
508
* *************************************************************************************/
509
/* Empty define for SCOREP_USER_FUNC_DEFINE to allow documentation of the macro and
510
let it disappear in C/C++ codes */
511
#define SCOREP_USER_FUNC_DEFINE()
512
513
#ifdef SCOREP_USER_ENABLE
514
515
#define SCOREP_USER_REGION_DEFINE( handle ) \
516
static SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION;
517
518
#define SCOREP_USER_REGION_ENTER( handle ) SCOREP_User_RegionEnter( handle );
519
520
#define SCOREP_USER_REGION_BEGIN( handle, name, type ) SCOREP_User_RegionBegin( \
521
&handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \
522
type, __FILE__, __LINE__ );
523
524
#define SCOREP_USER_REGION_INIT( handle, name, type ) SCOREP_User_RegionInit( \
525
&handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \
526
type, __FILE__, __LINE__ );
527
528
#define SCOREP_USER_REGION_END( handle ) SCOREP_User_RegionEnd( handle );
529
530
/* automatic, name tagged region begin */
531
#define SCOREP_USER_REGION_BY_NAME_BEGIN( name, type ) SCOREP_User_RegionByNameBegin( \
532
name, type, "", 0 );
533
534
/* automatic, name tagged region end */
535
#define SCOREP_USER_REGION_BY_NAME_END( name ) SCOREP_User_RegionByNameEnd( name );
536
537
#define SCOREP_USER_REWIND_DEFINE( handle ) \
538
static SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION;
539
540
#define SCOREP_USER_REWIND_POINT( handle, name ) \
541
SCOREP_User_RewindRegionBegin( &handle, &SCOREP_User_LastFileName, \
542
&SCOREP_User_LastFileHandle, name, \
543
SCOREP_USER_REGION_TYPE_COMMON, __FILE__, __LINE__ );
544
545
#define SCOREP_USER_REWIND_CHECK( handle, value ) \
546
SCOREP_User_RewindRegionEnd( handle, value );
547
548
#define SCOREP_USER_FUNC_BEGIN() static SCOREP_User_RegionHandle \
549
scorep_user_func_handle = SCOREP_USER_INVALID_REGION; \
550
SCOREP_User_RegionBegin( &scorep_user_func_handle, &SCOREP_User_LastFileName, \
551
&SCOREP_User_LastFileHandle, SCOREP_USER_FUNCTION_NAME, \
552
SCOREP_USER_REGION_TYPE_FUNCTION, __FILE__, __LINE__ );
553
554
#define SCOREP_USER_FUNC_END() SCOREP_User_RegionEnd( scorep_user_func_handle );
555
556
#define SCOREP_USER_GLOBAL_REGION_DEFINE( handle ) \
557
SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION;
558
559
#define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle ) \
560
extern SCOREP_User_RegionHandle handle;
561
562
#endif // SCOREP_USER_ENABLE
563
564
/* **************************************************************************************
565
* Documentation for Parameter macros
566
* *************************************************************************************/
567
661
/* **************************************************************************************
662
* Parameter macros
663
* *************************************************************************************/
664
#ifdef SCOREP_USER_ENABLE
665
666
#define SCOREP_USER_PARAMETER_INT64( name, value ) { \
667
static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \
668
SCOREP_User_ParameterInt64( &scorep_param, name, value ); }
669
670
#define SCOREP_USER_PARAMETER_UINT64( name, value ) { \
671
static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \
672
SCOREP_User_ParameterUint64( &scorep_param, name, value ); }
673
674
#define SCOREP_USER_PARAMETER_STRING( name, value ) { \
675
static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \
676
SCOREP_User_ParameterString( &scorep_param, name, value ); }
677
678
#endif // SCOREP_USER_ENABLE
679
680
/* **************************************************************************************
681
* Documentation for User Metric macros
682
* *************************************************************************************/
683
1015
/* **************************************************************************************
1016
* User Counter macros
1017
* *************************************************************************************/
1018
#ifdef SCOREP_USER_ENABLE
1019
1020
#define SCOREP_USER_METRIC_LOCAL( metricHandle ) static SCOREP_SamplingSetHandle \
1021
metricHandle \
1022
= SCOREP_INVALID_SAMPLING_SET;
1023
1024
#define SCOREP_USER_METRIC_GLOBAL( metricHandle ) SCOREP_SamplingSetHandle metricHandle \
1025
= SCOREP_INVALID_SAMPLING_SET;
1026
1027
#define SCOREP_USER_METRIC_EXTERNAL( metricHandle ) \
1028
extern SCOREP_SamplingSetHandle metricHandle;
1029
1030
#define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context ) \
1031
SCOREP_User_InitMetric( &metricHandle, name, unit, type, context );
1032
1033
#define SCOREP_USER_METRIC_INT64( metricHandle, \
1034
value ) SCOREP_User_TriggerMetricInt64( \
1035
metricHandle, value );
1036
1037
#define SCOREP_USER_METRIC_UINT64( metricHandle, \
1038
value ) SCOREP_User_TriggerMetricUint64( \
1039
metricHandle, value );
1040
1041
#define SCOREP_USER_METRIC_DOUBLE( metricHandle, \
1042
value ) SCOREP_User_TriggerMetricDouble( \
1043
metricHandle, value );
1044
1045
#endif // SCOREP_USER_ENABLE
1046
1047
/* ****************************************************************************
1048
* Documentation for Topology macros
1049
* ****************************************************************************/
1050
1148
/* **************************************************************************************
1149
* User Topology macros
1150
* *************************************************************************************/
1151
#ifdef SCOREP_USER_ENABLE
1152
1153
#define SCOREP_USER_CARTESIAN_TOPOLOGY_CREATE( userTopology, name, nDims ) \
1154
SCOREP_User_CartesianTopologyHandle userTopology = SCOREP_USER_INVALID_CARTESIAN_TOPOLOGY; \
1155
SCOREP_User_CartTopologyCreate( &userTopology, name, nDims );
1156
1157
#define SCOREP_USER_CARTESIAN_TOPOLOGY_ADD_DIM( userTopology, size, periodic, name ) \
1158
SCOREP_User_CartTopologyAddDim( userTopology, size, periodic, name );
1159
1160
#define SCOREP_USER_CARTESIAN_TOPOLOGY_INIT( userTopology ) \
1161
SCOREP_User_CartTopologyInit( userTopology );
1162
1163
#define SCOREP_USER_CARTESIAN_TOPOLOGY_SET_COORDS( userTopology, nDims, ... ) \
1164
SCOREP_User_CartTopologySetCoords( userTopology, nDims, __VA_ARGS__ );
1165
1166
#endif // SCOREP_USER_ENABLE
1167
1168
//just for doxygen completeness in Fortran case.
1169
#define SCOREP_USER_CARTESIAN_TOPOLOGY_DEFINE( userTopology )
1170
1171
/* **************************************************************************************
1172
* Documentation for C++ specific macros
1173
* *************************************************************************************/
1174
1206
/* **************************************************************************************
1207
* C++ specific macros
1208
* *************************************************************************************/
1209
#ifdef SCOREP_USER_ENABLE
1210
1211
#ifdef __cplusplus
1212
1213
/* We want to initialize the region handle only once and store it in a static variable.
1214
Thus, if the region is revisited, we do not need to evaluate filters and check double
1215
definitions. However, we want the region object reconstruct every time to execute
1216
the enter/exit in the constructor/destructor. The region handle in the class is
1217
necessary to pass the region handle from the constructor to the destructor. */
1218
#define SCOREP_USER_REGION( name, type ) static SCOREP_User_RegionHandle \
1219
scorep_user_region_handle = SCOREP_USER_INVALID_REGION; \
1220
SCOREP_User_RegionClass \
1221
scorep_user_region_inst( &scorep_user_region_handle, \
1222
name, \
1223
type, \
1224
&SCOREP_User_LastFileName, \
1225
&SCOREP_User_LastFileHandle, \
1226
__FILE__, __LINE__ );
1227
1228
#else // __cplusplus
1229
1230
#define SCOREP_USER_REGION( name, type )
1231
1232
#endif // __cplusplus
1233
1234
#endif // SCOREP_USER_ENABLE
1235
1236
/* **************************************************************************************
1237
* Documentation for Control macros
1238
* *************************************************************************************/
1239
1343
/* **************************************************************************************
1344
* Control macros
1345
* *************************************************************************************/
1346
1347
#ifdef SCOREP_USER_ENABLE
1348
1349
#define SCOREP_RECORDING_ON() SCOREP_User_EnableRecording();
1350
1351
#define SCOREP_RECORDING_OFF() SCOREP_User_DisableRecording();
1352
1353
#define SCOREP_RECORDING_IS_ON() SCOREP_User_RecordingEnabled()
1354
1355
#else // SCOREP_USER_ENABLE
1356
1357
/* **************************************************************************************
1358
* Empty macros, if user instrumentation is disabled
1359
* *************************************************************************************/
1360
1361
#define SCOREP_USER_REGION( name, type )
1362
#define SCOREP_USER_REGION_DEFINE( handle )
1363
#define SCOREP_USER_REWIND_DEFINE( handle )
1364
#define SCOREP_USER_REWIND_POINT( handle, name )
1365
#define SCOREP_USER_REGION_BEGIN( handle, name, type )
1366
#define SCOREP_USER_REGION_BY_NAME_BEGIN( name, type )
1367
#define SCOREP_USER_REGION_INIT( handle, name, type )
1368
#define SCOREP_USER_REGION_END( handle )
1369
#define SCOREP_USER_REGION_BY_NAME_END( name )
1370
#define SCOREP_USER_REWIND_CHECK( handle, value )
1371
#define SCOREP_USER_REGION_ENTER( handle )
1372
#define SCOREP_USER_FUNC_BEGIN()
1373
#define SCOREP_USER_FUNC_END()
1374
#define SCOREP_USER_GLOBAL_REGION_DEFINE( handle )
1375
#define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle )
1376
#define SCOREP_USER_PARAMETER_INT64( name, value )
1377
#define SCOREP_USER_PARAMETER_UINT64( name, value )
1378
#define SCOREP_USER_PARAMETER_STRING( name, value )
1379
#define SCOREP_USER_METRIC_GLOBAL( metricHandle )
1380
#define SCOREP_USER_METRIC_EXTERNAL( metricHandle )
1381
#define SCOREP_USER_METRIC_LOCAL( metricHandle )
1382
#define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context )
1383
#define SCOREP_USER_METRIC_INT64( metricHandle, value )
1384
#define SCOREP_USER_METRIC_UINT64( metricHandle, value )
1385
#define SCOREP_USER_METRIC_DOUBLE( metricHandle, value )
1386
#define SCOREP_RECORDING_ON()
1387
#define SCOREP_RECORDING_OFF()
1388
#define SCOREP_RECORDING_IS_ON() 0
1389
#define SCOREP_USER_CARTESIAN_TOPOLOGY_CREATE( userTopology, name, ndims )
1390
#define SCOREP_USER_CARTESIAN_TOPOLOGY_ADD_DIM( userTopology, size, periodic, name )
1391
#define SCOREP_USER_CARTESIAN_TOPOLOGY_INIT( userTopology )
1392
#define SCOREP_USER_CARTESIAN_TOPOLOGY_SET_COORDS( userTopology, nDims, ... )
1393
1394
#endif // SCOREP_USER_ENABLE
1395
1398
#endif
/* SCOREP_USER_H */
Report bugs to
support@score-p.org