44#include < sstream>
55
66using namespace omptest ;
7+ using namespace util ;
78
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) {
1311 if (Data == 0 && IsPointer)
1412 return " (nil)" ;
1513
@@ -21,10 +19,10 @@ std::string makeHexString(uint64_t Data, bool IsPointer = true,
2119 if (ShowHexBase)
2220 os << " 0x" ;
2321
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 ;
2624
27- if (DataBytes > 0 )
25+ if (MinBytes > 0 )
2826 os << std::setfill (' 0' ) << std::setw (NumDigits);
2927
3028 os << std::hex << Data;
@@ -55,6 +53,7 @@ std::string internal::ParallelBegin::toString() const {
5553}
5654
5755std::string internal::ParallelEnd::toString () const {
56+ // TODO: Should we expose more detailed info here?
5857 std::string S{" OMPT Callback ParallelEnd" };
5958 return S;
6059}
@@ -77,7 +76,7 @@ std::string internal::Dispatch::toString() const {
7776 S.append (" kind=" ).append (std::to_string (Kind));
7877 // TODO Check what to print for instance in all different cases
7978 if (Kind == ompt_dispatch_iteration) {
80- S.append (" instance[it=" )
79+ S.append (" instance= [it=" )
8180 .append (std::to_string (Instance.value ))
8281 .append (1 , ' ]' );
8382 } else if (Kind == ompt_dispatch_section) {
@@ -133,6 +132,7 @@ std::string internal::SyncRegion::toString() const {
133132}
134133
135134std::string internal::Target::toString () const {
135+ // TODO Should we canonicalize the string prefix (use "OMPT ..." everywhere)?
136136 std::string S{" Callback Target: target_id=" };
137137 S.append (std::to_string (TargetId));
138138 S.append (" kind=" ).append (std::to_string (Kind));
@@ -143,6 +143,7 @@ std::string internal::Target::toString() const {
143143}
144144
145145std::string internal::TargetEmi::toString () const {
146+ // TODO Should we canonicalize the string prefix (use "OMPT ..." everywhere)?
146147 std::string S{" Callback Target EMI: kind=" };
147148 S.append (std::to_string (Kind));
148149 S.append (" endpoint=" ).append (std::to_string (Endpoint));
@@ -338,7 +339,7 @@ std::string internal::BufferRecord::toString() const {
338339 break ;
339340 }
340341 default :
341- S.append (" Unsupported record type: " ). append ( std::to_string (Record. type ) );
342+ S.append (" (unsupported record type) " );
342343 break ;
343344 }
344345
0 commit comments