Internal change
PiperOrigin-RevId: 524485761
This commit is contained in:
committed by
Copybara-Service
parent
1c3a061038
commit
b63a0e15a3
@@ -43,7 +43,7 @@ ABSL_FLAG(std::string, system_cpu_max_freq_file,
|
||||
namespace mediapipe {
|
||||
namespace {
|
||||
|
||||
constexpr uint32 kBufferLength = 64;
|
||||
constexpr uint32_t kBufferLength = 64;
|
||||
|
||||
absl::StatusOr<std::string> GetFilePath(int cpu) {
|
||||
if (!absl::StrContains(absl::GetFlag(FLAGS_system_cpu_max_freq_file), "$0")) {
|
||||
@@ -54,7 +54,7 @@ absl::StatusOr<std::string> GetFilePath(int cpu) {
|
||||
return absl::Substitute(absl::GetFlag(FLAGS_system_cpu_max_freq_file), cpu);
|
||||
}
|
||||
|
||||
absl::StatusOr<uint64> GetCpuMaxFrequency(int cpu) {
|
||||
absl::StatusOr<uint64_t> GetCpuMaxFrequency(int cpu) {
|
||||
auto path_or_status = GetFilePath(cpu);
|
||||
if (!path_or_status.ok()) {
|
||||
return path_or_status.status();
|
||||
@@ -65,7 +65,7 @@ absl::StatusOr<uint64> GetCpuMaxFrequency(int cpu) {
|
||||
char buffer[kBufferLength];
|
||||
file.getline(buffer, kBufferLength);
|
||||
file.close();
|
||||
uint64 frequency;
|
||||
uint64_t frequency;
|
||||
if (absl::SimpleAtoi(buffer, &frequency)) {
|
||||
return frequency;
|
||||
} else {
|
||||
@@ -79,7 +79,7 @@ absl::StatusOr<uint64> GetCpuMaxFrequency(int cpu) {
|
||||
}
|
||||
|
||||
std::set<int> InferLowerOrHigherCoreIds(bool lower) {
|
||||
std::vector<std::pair<int, uint64>> cpu_freq_pairs;
|
||||
std::vector<std::pair<int, uint64_t>> cpu_freq_pairs;
|
||||
for (int cpu = 0; cpu < NumCPUCores(); ++cpu) {
|
||||
auto freq_or_status = GetCpuMaxFrequency(cpu);
|
||||
if (freq_or_status.ok()) {
|
||||
@@ -90,12 +90,12 @@ std::set<int> InferLowerOrHigherCoreIds(bool lower) {
|
||||
return {};
|
||||
}
|
||||
|
||||
absl::c_sort(cpu_freq_pairs, [lower](const std::pair<int, uint64>& left,
|
||||
const std::pair<int, uint64>& right) {
|
||||
absl::c_sort(cpu_freq_pairs, [lower](const std::pair<int, uint64_t>& left,
|
||||
const std::pair<int, uint64_t>& right) {
|
||||
return (lower && left.second < right.second) ||
|
||||
(!lower && left.second > right.second);
|
||||
});
|
||||
uint64 edge_freq = cpu_freq_pairs[0].second;
|
||||
uint64_t edge_freq = cpu_freq_pairs[0].second;
|
||||
|
||||
std::set<int> inferred_cores;
|
||||
for (const auto& cpu_freq_pair : cpu_freq_pairs) {
|
||||
|
||||
Reference in New Issue
Block a user