[CP] [4_2_1_release] replace std::stoull to strtoull
This commit is contained in:
parent
202a87b8a7
commit
f8b46b62ff
4
deps/oblib/src/lib/thread/thread.cpp
vendored
4
deps/oblib/src/lib/thread/thread.cpp
vendored
@ -403,10 +403,10 @@ int Thread::get_cpu_time_inc(int64_t &cpu_time_inc)
|
||||
char *field_ptr = strtok_r(stat_content, " ", &save_ptr);
|
||||
while (field_ptr != NULL) {
|
||||
if (field_index == USER_TIME_FIELD_INDEX) {
|
||||
cpu_time += std::stoul(field_ptr) * 1000000 / sysconf(_SC_CLK_TCK);
|
||||
cpu_time += strtoul(field_ptr, NULL, 10) * 1000000 / sysconf(_SC_CLK_TCK);
|
||||
}
|
||||
if (field_index == SYSTEM_TIME_FIELD_INDEX) {
|
||||
cpu_time += std::stoul(field_ptr) * 1000000 / sysconf(_SC_CLK_TCK);
|
||||
cpu_time += strtoul(field_ptr, NULL, 10) * 1000000 / sysconf(_SC_CLK_TCK);
|
||||
break;
|
||||
}
|
||||
field_ptr = strtok_r(NULL, " ", &save_ptr);
|
||||
|
@ -678,7 +678,7 @@ int ObCgroupCtrl::get_cpu_usage(const uint64_t tenant_id, int32_t &cpu_usage)
|
||||
K(ret), K(usage_path), K(usage_value), K(tenant_id));
|
||||
} else {
|
||||
usage_value[VALUE_BUFSIZE] = '\0';
|
||||
cur_usage = std::stoull(usage_value);
|
||||
cur_usage = strtoull(usage_value, NULL, 10);
|
||||
}
|
||||
|
||||
cpu_usage = 0;
|
||||
@ -706,7 +706,7 @@ int ObCgroupCtrl::get_cpu_time(const uint64_t tenant_id, int64_t &cpu_time)
|
||||
K(ret), K(usage_path), K(usage_value), K(tenant_id));
|
||||
} else {
|
||||
usage_value[VALUE_BUFSIZE] = '\0';
|
||||
cpu_time = std::stoull(usage_value) / 1000;
|
||||
cpu_time = strtoull(usage_value, NULL, 10) / 1000;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user