| 26 | constexpr int32_t TASKID_PID_PREFIX_LEN = 4; |
| 27 | |
| 28 | int32_t extractStageId(const std::string& taskId) { |
| 29 | BOLT_CHECK( |
| 30 | taskId.length() > TASKID_PREFIX_LEN && |
| 31 | taskId.compare(0, TASKID_PREFIX_LEN, TASKID_PREFIX) == 0); |
| 32 | int32_t pos = TASKID_PREFIX_LEN; |
| 33 | int number = 0; |
| 34 | bool hasDigit = false; |
| 35 | while (pos < taskId.length() && taskId[pos] != '_') { |
| 36 | if (FOLLY_UNLIKELY(!isdigit(static_cast<unsigned char>(taskId[pos])))) { |
| 37 | BOLT_FAIL("taskid should be digit, taskId {}", taskId); |
| 38 | } |
| 39 | number = number * 10 + (taskId[pos] - '0'); |
| 40 | hasDigit = true; |
| 41 | ++pos; |
| 42 | } |
| 43 | BOLT_CHECK(hasDigit); |
| 44 | |
| 45 | return number; |
| 46 | } |
| 47 | |
| 48 | int64_t extractTaskTid(const std::string& taskId) { |
| 49 | const size_t pos = taskId.find("TID_"); |
no test coverage detected