4
4
#include < sstream>
5
5
6
6
using namespace omptest ;
7
+ using namespace util ;
7
8
8
- // / String manipulation helper function. Takes up to 8 bytes of data and returns
9
- // / their hexadecimal representation as string. The data can be truncated to a
10
- // / certain size in bytes and will by default be prefixed with '0x'.
11
- std::string makeHexString (uint64_t Data, bool IsPointer = true ,
12
- size_t DataBytes = 0 , bool ShowHexBase = true ) {
9
+ std::string util::makeHexString (uint64_t Data, bool IsPointer, size_t MinBytes,
10
+ bool ShowHexBase) {
13
11
if (Data == 0 && IsPointer)
14
12
return " (nil)" ;
15
13
@@ -21,10 +19,10 @@ std::string makeHexString(uint64_t Data, bool IsPointer = true,
21
19
if (ShowHexBase)
22
20
os << " 0x" ;
23
21
24
- // Default to 32bit (8 hex digits) width if exceeding 64bit or zero value
25
- size_t NumDigits = (DataBytes > 0 && DataBytes < 9 ) ? (DataBytes << 1 ) : 8 ;
22
+ // Default to 32bit (8 hex digits) width, if exceeding 64bit or zero value
23
+ size_t NumDigits = (MinBytes > 0 && MinBytes < 9 ) ? (MinBytes << 1 ) : 8 ;
26
24
27
- if (DataBytes > 0 )
25
+ if (MinBytes > 0 )
28
26
os << std::setfill (' 0' ) << std::setw (NumDigits);
29
27
30
28
os << std::hex << Data;
@@ -55,6 +53,7 @@ std::string internal::ParallelBegin::toString() const {
55
53
}
56
54
57
55
std::string internal::ParallelEnd::toString () const {
56
+ // TODO: Should we expose more detailed info here?
58
57
std::string S{" OMPT Callback ParallelEnd" };
59
58
return S;
60
59
}
@@ -77,7 +76,7 @@ std::string internal::Dispatch::toString() const {
77
76
S.append (" kind=" ).append (std::to_string (Kind));
78
77
// TODO Check what to print for instance in all different cases
79
78
if (Kind == ompt_dispatch_iteration) {
80
- S.append (" instance[it=" )
79
+ S.append (" instance= [it=" )
81
80
.append (std::to_string (Instance.value ))
82
81
.append (1 , ' ]' );
83
82
} else if (Kind == ompt_dispatch_section) {
@@ -133,6 +132,7 @@ std::string internal::SyncRegion::toString() const {
133
132
}
134
133
135
134
std::string internal::Target::toString () const {
135
+ // TODO Should we canonicalize the string prefix (use "OMPT ..." everywhere)?
136
136
std::string S{" Callback Target: target_id=" };
137
137
S.append (std::to_string (TargetId));
138
138
S.append (" kind=" ).append (std::to_string (Kind));
@@ -143,6 +143,7 @@ std::string internal::Target::toString() const {
143
143
}
144
144
145
145
std::string internal::TargetEmi::toString () const {
146
+ // TODO Should we canonicalize the string prefix (use "OMPT ..." everywhere)?
146
147
std::string S{" Callback Target EMI: kind=" };
147
148
S.append (std::to_string (Kind));
148
149
S.append (" endpoint=" ).append (std::to_string (Endpoint));
@@ -338,7 +339,7 @@ std::string internal::BufferRecord::toString() const {
338
339
break ;
339
340
}
340
341
default :
341
- S.append (" Unsupported record type: " ). append ( std::to_string (Record. type ) );
342
+ S.append (" (unsupported record type) " );
342
343
break ;
343
344
}
344
345
0 commit comments