MCPcopy Create free account
hub / github.com/apache/impala / SetThreadName

Method SetThreadName

be/src/common/thread-debug-info.h:74–91  ·  view source on GitHub ↗

Saves param 'thread_name' to member 'thread_name_'. If the length of param 'thread_name' is larger than THREAD_NAME_SIZE, we store the front of 'thread_name' + '...' + the last few bytes of thread name, e.g.: "Long Threadname with more te...001afec4)"

Source from the content-addressed store, hash-verified

72 /// we store the front of 'thread_name' + '...' + the last few bytes
73 /// of thread name, e.g.: "Long Threadname with more te...001afec4)"
74 void SetThreadName(const std::string& thread_name) {
75 const int64_t length = thread_name.length();
76
77 if (length < THREAD_NAME_SIZE) {
78 thread_name.copy(thread_name_, length);
79 } else {
80 const int64_t tail_length = THREAD_NAME_TAIL_LENGTH;
81 // 4 is the length of "..." and '\0'
82 const int64_t front_length = THREAD_NAME_SIZE - tail_length - 4;
83 // copy 'front_length' sized front of 'thread_name' to 'thread_name_'
84 thread_name.copy(thread_name_, front_length);
85 // append "..."
86 for (int i = 0; i < 3; ++i) thread_name_[front_length + i] = '.';
87 // append 'tail_length' sized tail of 'thread_name' to 'thread_name_'
88 thread_name.copy(thread_name_ + front_length + 3, tail_length,
89 length - tail_length);
90 }
91 }
92
93 void SetParentInfo(const ThreadDebugInfo* parent) {
94 if (parent == nullptr) return;

Callers 2

TESTFunction · 0.45
CatalogdMainFunction · 0.45

Calls 2

lengthMethod · 0.45
copyMethod · 0.45

Tested by 1

TESTFunction · 0.36