![]() |
1.3 (revision 7349)
|
00001 /* 00002 * This file is part of the Score-P software (http://www.score-p.org) 00003 * 00004 * Copyright (c) 2009-2011, 00005 * RWTH Aachen University, Germany 00006 * 00007 * Copyright (c) 2009-2011, 00008 * Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany 00009 * 00010 * Copyright (c) 2009-2011, 2014, 00011 * Technische Universitaet Dresden, Germany 00012 * 00013 * Copyright (c) 2009-2011, 00014 * University of Oregon, Eugene, USA 00015 * 00016 * Copyright (c) 2009-2011, 2013-2014, 00017 * Forschungszentrum Juelich GmbH, Germany 00018 * 00019 * Copyright (c) 2009-2011, 2014 00020 * German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany 00021 * 00022 * Copyright (c) 2009-2011, 00023 * Technische Universitaet Muenchen, Germany 00024 * 00025 * This software may be modified and distributed under the terms of 00026 * a BSD-style license. See the COPYING file in the package base 00027 * directory for details. 00028 * 00029 */ 00030 00031 #ifndef SCOREP_USER_H 00032 #define SCOREP_USER_H 00033 00041 /* Guarded because it declares variables in every file where it is included. */ 00042 #ifdef SCOREP_USER_ENABLE 00043 #include <scorep/SCOREP_User_Variables.h> 00044 #include <scorep/SCOREP_User_Functions.h> 00045 #endif 00046 00047 /* Provide macro SCOREP_USER_FUNCTION_NAME that expands to the 00048 * function name of the enclosing function. */ 00049 #ifndef SCOREP_USER_FUNCTION_NAME 00050 #if defined( __cplusplus ) && defined( __FUJITSU ) 00051 #define SCOREP_USER_FUNCTION_NAME __FUNCTION__ 00052 #else 00053 #define SCOREP_USER_FUNCTION_NAME __func__ 00054 #endif 00055 #endif 00056 00088 /* ************************************************************************************** 00089 * Documentation for region enclosing macros 00090 * *************************************************************************************/ 00091 00637 /* ************************************************************************************** 00638 * Region enclosing macros 00639 * *************************************************************************************/ 00640 /* Empty define for SCOREP_USER_FUNC_DEFINE to allow documentation of the macro and 00641 let it disappear in C/C++ codes */ 00642 #define SCOREP_USER_FUNC_DEFINE() 00643 00644 #ifdef SCOREP_USER_ENABLE 00645 00646 #define SCOREP_USER_OA_PHASE_BEGIN( handle, name, type ) SCOREP_User_OaPhaseBegin( \ 00647 &handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \ 00648 type, __FILE__, __LINE__ ); 00649 00650 #define SCOREP_USER_OA_PHASE_END( handle ) \ 00651 SCOREP_User_OaPhaseEnd( handle ); 00652 00653 #define SCOREP_USER_REGION_DEFINE( handle ) \ 00654 static SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION; 00655 00656 #define SCOREP_USER_REGION_ENTER( handle ) SCOREP_User_RegionEnter( handle ); 00657 00658 #define SCOREP_USER_REGION_BEGIN( handle, name, type ) SCOREP_User_RegionBegin( \ 00659 &handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \ 00660 type, __FILE__, __LINE__ ); 00661 00662 #define SCOREP_USER_REGION_INIT( handle, name, type ) SCOREP_User_RegionInit( \ 00663 &handle, &SCOREP_User_LastFileName, &SCOREP_User_LastFileHandle, name, \ 00664 type, __FILE__, __LINE__ ); 00665 00666 #define SCOREP_USER_REGION_END( handle ) SCOREP_User_RegionEnd( handle ); 00667 00668 #define SCOREP_USER_REWIND_DEFINE( handle ) \ 00669 static SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION; 00670 00671 #define SCOREP_USER_REWIND_POINT( handle, name ) \ 00672 SCOREP_User_RewindRegionBegin( &handle, &SCOREP_User_LastFileName, \ 00673 &SCOREP_User_LastFileHandle, name, \ 00674 SCOREP_USER_REGION_TYPE_COMMON, __FILE__, __LINE__ ); 00675 00676 #define SCOREP_USER_REWIND_CHECK( handle, value ) \ 00677 SCOREP_User_RewindRegionEnd( handle, value ); 00678 00679 #define SCOREP_USER_FUNC_BEGIN() static SCOREP_User_RegionHandle \ 00680 scorep_user_func_handle = SCOREP_USER_INVALID_REGION; \ 00681 SCOREP_User_RegionBegin( &scorep_user_func_handle, &SCOREP_User_LastFileName, \ 00682 &SCOREP_User_LastFileHandle, SCOREP_USER_FUNCTION_NAME, \ 00683 SCOREP_USER_REGION_TYPE_FUNCTION, __FILE__, __LINE__ ); 00684 00685 #define SCOREP_USER_FUNC_END() SCOREP_User_RegionEnd( scorep_user_func_handle ); 00686 00687 #define SCOREP_USER_GLOBAL_REGION_DEFINE( handle ) \ 00688 SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION; 00689 00690 #define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle ) \ 00691 extern SCOREP_User_RegionHandle handle; 00692 00693 #endif // SCOREP_USER_ENABLE 00694 00695 /* ************************************************************************************** 00696 * Documentation for Parameter macros 00697 * *************************************************************************************/ 00698 00792 /* ************************************************************************************** 00793 * Parameter macros 00794 * *************************************************************************************/ 00795 #ifdef SCOREP_USER_ENABLE 00796 00797 #define SCOREP_USER_PARAMETER_INT64( name, value ) { \ 00798 static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \ 00799 SCOREP_User_ParameterInt64( &scorep_param, name, value ); } 00800 00801 #define SCOREP_USER_PARAMETER_UINT64( name, value ) { \ 00802 static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \ 00803 SCOREP_User_ParameterUint64( &scorep_param, name, value ); } 00804 00805 #define SCOREP_USER_PARAMETER_STRING( name, value ) { \ 00806 static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \ 00807 SCOREP_User_ParameterString( &scorep_param, name, value ); } 00808 00809 #endif // SCOREP_USER_ENABLE 00810 00811 /* ************************************************************************************** 00812 * Documentation for User Metric macros 00813 * *************************************************************************************/ 00814 01146 /* ************************************************************************************** 01147 * User Counter macros 01148 * *************************************************************************************/ 01149 #ifdef SCOREP_USER_ENABLE 01150 01151 #define SCOREP_USER_METRIC_LOCAL( metricHandle ) static SCOREP_SamplingSetHandle \ 01152 metricHandle \ 01153 = SCOREP_INVALID_SAMPLING_SET; 01154 01155 #define SCOREP_USER_METRIC_GLOBAL( metricHandle ) SCOREP_SamplingSetHandle metricHandle \ 01156 = SCOREP_INVALID_SAMPLING_SET; 01157 01158 #define SCOREP_USER_METRIC_EXTERNAL( metricHandle ) \ 01159 extern SCOREP_SamplingSetHandle metricHandle; 01160 01161 #define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context ) \ 01162 SCOREP_User_InitMetric( &metricHandle, name, unit, type, context ); 01163 01164 #define SCOREP_USER_METRIC_INT64( metricHandle, \ 01165 value ) SCOREP_User_TriggerMetricInt64( \ 01166 metricHandle, value ); 01167 01168 #define SCOREP_USER_METRIC_UINT64( metricHandle, \ 01169 value ) SCOREP_User_TriggerMetricInt64( \ 01170 metricHandle, value ); 01171 01172 #define SCOREP_USER_METRIC_DOUBLE( metricHandle, \ 01173 value ) SCOREP_User_TriggerMetricDouble( \ 01174 metricHandle, value ); 01175 01176 #endif // SCOREP_USER_ENABLE 01177 01178 /* ************************************************************************************** 01179 * Documentation for C++ specific macros 01180 * *************************************************************************************/ 01181 01213 /* ************************************************************************************** 01214 * C++ specific macros 01215 * *************************************************************************************/ 01216 #ifdef SCOREP_USER_ENABLE 01217 01218 #ifdef __cplusplus 01219 01220 /* We want to initialize the region handle only once and store it in a static variable. 01221 Thus, if the region is revisited, we do not need to evaluate filters and check double 01222 definitions. However, we want the region object reconstruct every time to execute 01223 the enter/exit in the constructor/destructor. The region handle in the class is 01224 necessary to pass the region handle from the constructor to the destructor. */ 01225 #define SCOREP_USER_REGION( name, type ) static SCOREP_User_RegionHandle \ 01226 scorep_user_region_handle = SCOREP_USER_INVALID_REGION; \ 01227 SCOREP_User_RegionClass \ 01228 scorep_user_region_inst( &scorep_user_region_handle, \ 01229 name, \ 01230 type, \ 01231 &SCOREP_User_LastFileName, \ 01232 &SCOREP_User_LastFileHandle, \ 01233 __FILE__, __LINE__ ); 01234 01235 #else // __cplusplus 01236 01237 #define SCOREP_USER_REGION( name, type ) 01238 01239 #endif // __cplusplus 01240 01241 #endif // SCOREP_USER_ENABLE 01242 01243 /* ************************************************************************************** 01244 * Documentation for Control macros 01245 * *************************************************************************************/ 01246 01350 /* ************************************************************************************** 01351 * Control macros 01352 * *************************************************************************************/ 01353 01354 #ifdef SCOREP_USER_ENABLE 01355 01356 #define SCOREP_RECORDING_ON() SCOREP_User_EnableRecording(); 01357 01358 #define SCOREP_RECORDING_OFF() SCOREP_User_DisableRecording(); 01359 01360 #define SCOREP_RECORDING_IS_ON() SCOREP_User_RecordingEnabled() 01361 01362 #else // SCOREP_USER_ENABLE 01363 01364 /* ************************************************************************************** 01365 * Empty macros, if user instrumentation is disabled 01366 * *************************************************************************************/ 01367 01368 #define SCOREP_USER_REGION( name, type ) 01369 #define SCOREP_USER_REGION_DEFINE( handle ) 01370 #define SCOREP_USER_REWIND_DEFINE( handle ) 01371 #define SCOREP_USER_OA_PHASE_BEGIN( handle, name, type ) 01372 #define SCOREP_USER_OA_PHASE_END( handle ) 01373 #define SCOREP_USER_REWIND_POINT( handle, name ) 01374 #define SCOREP_USER_REGION_BEGIN( handle, name, type ) 01375 #define SCOREP_USER_REGION_INIT( handle, name, type ) 01376 #define SCOREP_USER_REGION_END( handle ) 01377 #define SCOREP_USER_REWIND_CHECK( handle, value ) 01378 #define SCOREP_USER_REGION_ENTER( handle ) 01379 #define SCOREP_USER_FUNC_BEGIN() 01380 #define SCOREP_USER_FUNC_END() 01381 #define SCOREP_USER_GLOBAL_REGION_DEFINE( handle ) 01382 #define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle ) 01383 #define SCOREP_USER_PARAMETER_INT64( name, value ) 01384 #define SCOREP_USER_PARAMETER_UINT64( name, value ) 01385 #define SCOREP_USER_PARAMETER_STRING( name, value ) 01386 #define SCOREP_USER_METRIC_GLOBAL( metricHandle ) 01387 #define SCOREP_USER_METRIC_EXTERNAL( metricHandle ) 01388 #define SCOREP_USER_METRIC_LOCAL( metricHandle ) 01389 #define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context ) 01390 #define SCOREP_USER_METRIC_INT64( metricHandle, value ) 01391 #define SCOREP_USER_METRIC_UINT64( metricHandle, value ) 01392 #define SCOREP_USER_METRIC_DOUBLE( metricHandle, value ) 01393 #define SCOREP_RECORDING_ON() 01394 #define SCOREP_RECORDING_OFF() 01395 #define SCOREP_RECORDING_IS_ON() 0 01396 01397 #endif // SCOREP_USER_ENABLE 01398 01401 #endif // SCOREP_USER_H