Last change
on this file since 6607 was
6607,
checked in by acosce, 10 months ago
|
XIOS used for ICOLMDZORINCA_CO2_Transport_GMD_2023
|
File size:
1.8 KB
|
Rev | Line | |
---|
[6607] | 1 | #include "tracer.hpp" |
---|
| 2 | |
---|
| 3 | #if defined(VTRACE) |
---|
| 4 | |
---|
| 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 | |
---|
| 15 | #endif |
---|
| 16 | |
---|
| 17 | #include <string> |
---|
| 18 | #include <map> |
---|
| 19 | #include <iostream> |
---|
| 20 | |
---|
| 21 | namespace xios |
---|
| 22 | { |
---|
| 23 | using namespace std ; |
---|
| 24 | |
---|
| 25 | std::map<std::string,int> regionId ; |
---|
| 26 | int count=0 ; |
---|
| 27 | |
---|
| 28 | void traceOn(void) |
---|
| 29 | { |
---|
| 30 | #if defined(VTRACE) |
---|
| 31 | VT_ON() ; |
---|
| 32 | #elif defined(SCOREP) |
---|
| 33 | SCOREP_RECORDING_ON() ; |
---|
| 34 | #elif defined(ITAC) |
---|
| 35 | VT_traceon() ; |
---|
| 36 | #endif |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | void traceOff(void) |
---|
| 40 | { |
---|
| 41 | #if defined(VTRACE) |
---|
| 42 | VT_OFF() ; |
---|
| 43 | #elif defined(SCOREP) |
---|
| 44 | SCOREP_RECORDING_OFF() |
---|
| 45 | #elif defined(ITAC) |
---|
| 46 | VT_traceoff() ; |
---|
| 47 | #endif |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | void traceBegin(const string& name) |
---|
| 51 | { |
---|
| 52 | #if defined(VTRACE) |
---|
| 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 | |
---|
| 71 | #endif |
---|
| 72 | |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | void traceEnd(const string& name) |
---|
| 76 | { |
---|
| 77 | #if defined (VTRACE) |
---|
| 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 | |
---|
| 94 | #endif |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | // void marker(const string& name,const string& text) ; |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.