![]() |
1.4.2 (revision 8839)
|
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-2015, 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-2015, 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 /* automatic, name tagged region begin */ 00669 #define SCOREP_USER_REGION_BY_NAME_BEGIN( name, type ) SCOREP_User_RegionByNameBegin( \ 00670 name, type, "", 0 ); 00671 00672 /* automatic, name tagged region end */ 00673 #define SCOREP_USER_REGION_BY_NAME_END( name ) SCOREP_User_RegionByNameEnd( name ); 00674 00675 #define SCOREP_USER_REWIND_DEFINE( handle ) \ 00676 static SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION; 00677 00678 #define SCOREP_USER_REWIND_POINT( handle, name ) \ 00679 SCOREP_User_RewindRegionBegin( &handle, &SCOREP_User_LastFileName, \ 00680 &SCOREP_User_LastFileHandle, name, \ 00681 SCOREP_USER_REGION_TYPE_COMMON, __FILE__, __LINE__ ); 00682 00683 #define SCOREP_USER_REWIND_CHECK( handle, value ) \ 00684 SCOREP_User_RewindRegionEnd( handle, value ); 00685 00686 #define SCOREP_USER_FUNC_BEGIN() static SCOREP_User_RegionHandle \ 00687 scorep_user_func_handle = SCOREP_USER_INVALID_REGION; \ 00688 SCOREP_User_RegionBegin( &scorep_user_func_handle, &SCOREP_User_LastFileName, \ 00689 &SCOREP_User_LastFileHandle, SCOREP_USER_FUNCTION_NAME, \ 00690 SCOREP_USER_REGION_TYPE_FUNCTION, __FILE__, __LINE__ ); 00691 00692 #define SCOREP_USER_FUNC_END() SCOREP_User_RegionEnd( scorep_user_func_handle ); 00693 00694 #define SCOREP_USER_GLOBAL_REGION_DEFINE( handle ) \ 00695 SCOREP_User_RegionHandle handle = SCOREP_USER_INVALID_REGION; 00696 00697 #define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle ) \ 00698 extern SCOREP_User_RegionHandle handle; 00699 00700 #endif // SCOREP_USER_ENABLE 00701 00702 /* ************************************************************************************** 00703 * Documentation for Parameter macros 00704 * *************************************************************************************/ 00705 00799 /* ************************************************************************************** 00800 * Parameter macros 00801 * *************************************************************************************/ 00802 #ifdef SCOREP_USER_ENABLE 00803 00804 #define SCOREP_USER_PARAMETER_INT64( name, value ) { \ 00805 static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \ 00806 SCOREP_User_ParameterInt64( &scorep_param, name, value ); } 00807 00808 #define SCOREP_USER_PARAMETER_UINT64( name, value ) { \ 00809 static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \ 00810 SCOREP_User_ParameterUint64( &scorep_param, name, value ); } 00811 00812 #define SCOREP_USER_PARAMETER_STRING( name, value ) { \ 00813 static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER; \ 00814 SCOREP_User_ParameterString( &scorep_param, name, value ); } 00815 00816 #endif // SCOREP_USER_ENABLE 00817 00818 /* ************************************************************************************** 00819 * Documentation for User Metric macros 00820 * *************************************************************************************/ 00821 01153 /* ************************************************************************************** 01154 * User Counter macros 01155 * *************************************************************************************/ 01156 #ifdef SCOREP_USER_ENABLE 01157 01158 #define SCOREP_USER_METRIC_LOCAL( metricHandle ) static SCOREP_SamplingSetHandle \ 01159 metricHandle \ 01160 = SCOREP_INVALID_SAMPLING_SET; 01161 01162 #define SCOREP_USER_METRIC_GLOBAL( metricHandle ) SCOREP_SamplingSetHandle metricHandle \ 01163 = SCOREP_INVALID_SAMPLING_SET; 01164 01165 #define SCOREP_USER_METRIC_EXTERNAL( metricHandle ) \ 01166 extern SCOREP_SamplingSetHandle metricHandle; 01167 01168 #define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context ) \ 01169 SCOREP_User_InitMetric( &metricHandle, name, unit, type, context ); 01170 01171 #define SCOREP_USER_METRIC_INT64( metricHandle, \ 01172 value ) SCOREP_User_TriggerMetricInt64( \ 01173 metricHandle, value ); 01174 01175 #define SCOREP_USER_METRIC_UINT64( metricHandle, \ 01176 value ) SCOREP_User_TriggerMetricUint64( \ 01177 metricHandle, value ); 01178 01179 #define SCOREP_USER_METRIC_DOUBLE( metricHandle, \ 01180 value ) SCOREP_User_TriggerMetricDouble( \ 01181 metricHandle, value ); 01182 01183 #endif // SCOREP_USER_ENABLE 01184 01185 /* ************************************************************************************** 01186 * Documentation for C++ specific macros 01187 * *************************************************************************************/ 01188 01220 /* ************************************************************************************** 01221 * C++ specific macros 01222 * *************************************************************************************/ 01223 #ifdef SCOREP_USER_ENABLE 01224 01225 #ifdef __cplusplus 01226 01227 /* We want to initialize the region handle only once and store it in a static variable. 01228 Thus, if the region is revisited, we do not need to evaluate filters and check double 01229 definitions. However, we want the region object reconstruct every time to execute 01230 the enter/exit in the constructor/destructor. The region handle in the class is 01231 necessary to pass the region handle from the constructor to the destructor. */ 01232 #define SCOREP_USER_REGION( name, type ) static SCOREP_User_RegionHandle \ 01233 scorep_user_region_handle = SCOREP_USER_INVALID_REGION; \ 01234 SCOREP_User_RegionClass \ 01235 scorep_user_region_inst( &scorep_user_region_handle, \ 01236 name, \ 01237 type, \ 01238 &SCOREP_User_LastFileName, \ 01239 &SCOREP_User_LastFileHandle, \ 01240 __FILE__, __LINE__ ); 01241 01242 #else // __cplusplus 01243 01244 #define SCOREP_USER_REGION( name, type ) 01245 01246 #endif // __cplusplus 01247 01248 #endif // SCOREP_USER_ENABLE 01249 01250 /* ************************************************************************************** 01251 * Documentation for Control macros 01252 * *************************************************************************************/ 01253 01357 /* ************************************************************************************** 01358 * Control macros 01359 * *************************************************************************************/ 01360 01361 #ifdef SCOREP_USER_ENABLE 01362 01363 #define SCOREP_RECORDING_ON() SCOREP_User_EnableRecording(); 01364 01365 #define SCOREP_RECORDING_OFF() SCOREP_User_DisableRecording(); 01366 01367 #define SCOREP_RECORDING_IS_ON() SCOREP_User_RecordingEnabled() 01368 01369 #else // SCOREP_USER_ENABLE 01370 01371 /* ************************************************************************************** 01372 * Empty macros, if user instrumentation is disabled 01373 * *************************************************************************************/ 01374 01375 #define SCOREP_USER_REGION( name, type ) 01376 #define SCOREP_USER_REGION_DEFINE( handle ) 01377 #define SCOREP_USER_REWIND_DEFINE( handle ) 01378 #define SCOREP_USER_OA_PHASE_BEGIN( handle, name, type ) 01379 #define SCOREP_USER_OA_PHASE_END( handle ) 01380 #define SCOREP_USER_REWIND_POINT( handle, name ) 01381 #define SCOREP_USER_REGION_BEGIN( handle, name, type ) 01382 #define SCOREP_USER_REGION_BY_NAME_BEGIN( name, type ) 01383 #define SCOREP_USER_REGION_INIT( handle, name, type ) 01384 #define SCOREP_USER_REGION_END( handle ) 01385 #define SCOREP_USER_REGION_BY_NAME_END( name ) 01386 #define SCOREP_USER_REWIND_CHECK( handle, value ) 01387 #define SCOREP_USER_REGION_ENTER( handle ) 01388 #define SCOREP_USER_FUNC_BEGIN() 01389 #define SCOREP_USER_FUNC_END() 01390 #define SCOREP_USER_GLOBAL_REGION_DEFINE( handle ) 01391 #define SCOREP_USER_GLOBAL_REGION_EXTERNAL( handle ) 01392 #define SCOREP_USER_PARAMETER_INT64( name, value ) 01393 #define SCOREP_USER_PARAMETER_UINT64( name, value ) 01394 #define SCOREP_USER_PARAMETER_STRING( name, value ) 01395 #define SCOREP_USER_METRIC_GLOBAL( metricHandle ) 01396 #define SCOREP_USER_METRIC_EXTERNAL( metricHandle ) 01397 #define SCOREP_USER_METRIC_LOCAL( metricHandle ) 01398 #define SCOREP_USER_METRIC_INIT( metricHandle, name, unit, type, context ) 01399 #define SCOREP_USER_METRIC_INT64( metricHandle, value ) 01400 #define SCOREP_USER_METRIC_UINT64( metricHandle, value ) 01401 #define SCOREP_USER_METRIC_DOUBLE( metricHandle, value ) 01402 #define SCOREP_RECORDING_ON() 01403 #define SCOREP_RECORDING_OFF() 01404 #define SCOREP_RECORDING_IS_ON() 0 01405 01406 #endif // SCOREP_USER_ENABLE 01407 01410 #endif // SCOREP_USER_H