Changeset 1661 for XIOS/dev/dev_trunk_omp/src/tracer.cpp
- Timestamp:
- 05/15/19 17:19:08 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/src/tracer.cpp
r501 r1661 1 1 #include "tracer.hpp" 2 #ifdef VTRACE 2 3 #if defined(VTRACE) 4 3 5 #include <vt_user.h> 6 7 #elif defined(SCOREP) 8 9 #include <scorep/SCOREP_User.h> 10 11 #elif defined(ITAC) 12 13 #include <VT.h> 14 4 15 #endif 16 5 17 #include <string> 18 #include <map> 19 #include <iostream> 6 20 7 21 namespace xios 8 22 { 9 23 using namespace std ; 24 25 std::map<std::string,int> regionId ; 26 int count=0 ; 10 27 11 28 void traceOn(void) 12 29 { 13 #if def VTRACE30 #if defined(VTRACE) 14 31 VT_ON() ; 32 #elif defined(SCOREP) 33 SCOREP_RECORDING_ON() ; 34 #elif defined(ITAC) 35 VT_traceon() ; 15 36 #endif 16 37 } … … 18 39 void traceOff(void) 19 40 { 20 #if def VTRACE41 #if defined(VTRACE) 21 42 VT_OFF() ; 43 #elif defined(SCOREP) 44 SCOREP_RECORDING_OFF() 45 #elif defined(ITAC) 46 VT_traceoff() ; 22 47 #endif 23 48 } … … 25 50 void traceBegin(const string& name) 26 51 { 27 #if def VTRACE52 #if defined(VTRACE) 28 53 VT_USER_START(name.c_str()) ; 54 #elif defined(SCOREP) 55 SCOREP_USER_REGION_BY_NAME_BEGIN(name.c_str(),SCOREP_USER_REGION_TYPE_COMMON) 56 57 #elif defined(ITAC) 58 int classhandle ; 59 auto it = regionId.find(name); 60 if (it==regionId.end()) 61 { 62 classhandle=count ; 63 count++ ; 64 VT_symdef (classhandle, name.c_str(), "XIOS") ; 65 regionId[name]=classhandle; 66 } 67 else classhandle = it->second ; 68 VT_begin(classhandle) ; 69 cout<<"VT_begin "<<name<<" "<<classhandle<<endl ; 70 29 71 #endif 72 30 73 } 31 74 32 75 void traceEnd(const string& name) 33 76 { 34 #if def VTRACE77 #if defined (VTRACE) 35 78 VT_USER_END(name.c_str()) ; 79 #elif defined(SCOREP) 80 SCOREP_USER_REGION_BY_NAME_END(name.c_str()) 81 #elif defined(ITAC) 82 int classhandle ; 83 auto it = regionId.find(name); 84 if (it==regionId.end()) 85 { 86 return ; 87 VT_classdef (name.c_str(), &classhandle) ; 88 regionId[name]=classhandle; 89 } 90 else classhandle = it->second ; 91 VT_end(classhandle) ; 92 cout<<"VT_end "<<name<<" "<<classhandle<<endl ; 93 36 94 #endif 37 95 } 38 96 97 39 98 // void marker(const string& name,const string& text) ; 40 99
Note: See TracChangeset
for help on using the changeset viewer.